Unverified Commit a87c7a4a authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

avoid segfault

parent 64a4bf6a
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -1466,10 +1466,12 @@ double *Image::color2rgb(const char *color, int index)
    return userrgb[-index-1];
  }

  if (color) {
    for (int i = 0; i < ncolors; i++)
      if (strcmp(color,username[i]) == 0) return userrgb[i];
    for (int i = 0; i < NCOLORS; i++)
      if (strcmp(color,name[i]) == 0) return rgb[i];
  }
  return NULL;
}