nanosvg
nanosvg copied to clipboard
Bug: "else" missing
In nanosvgrast.h, line 1285:
if (grad->nstops == 0) {
for (i = 0; i < 256; i++)
cache->colors[i] = 0;
} if (grad->nstops == 1) {
for (i = 0; i < 256; i++)
cache->colors[i] = nsvg__applyOpacity(grad->stops[i].color, opacity);
} else {
Pretty sure an "else" is missing in front of the 2nd "if"
You are IMHO right. And that would mean it will go into the 'else' case when grad->nstops = 0
and will do nonsense there or segfault as it loops with for (i = 0; i < grad->nstops-1; i++)
. @memononen ?
Looks reasonable ! Could you prepare a pull request? This makes it easy for memonen to just push one button. The message is nearly 6 months old? Ok, I was not aware of it.
Take care, Harald
This issue should be closed now that a fix is merged. Also commits that reference issues are trouble, PR comments that say "Fixes #NNN" are good because GH actually acts on them automatically, but commits are trouble because they show up in forks and rebases and such and keep pinging issues & people long after they are relevant. Just tips for future usage...