changeset 84351:162e36293ef2

(gif_load): Fix bug: Handle nonexistent colormap.
author Thien-Thi Nguyen <ttn@gnuvola.org>
date Thu, 06 Sep 2007 20:23:57 +0000
parents 13fc3289f099
children 7d258290f9f0
files src/image.c
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/image.c	Thu Sep 06 19:46:17 2007 +0000
+++ b/src/image.c	Thu Sep 06 20:23:57 2007 +0000
@@ -7886,13 +7886,14 @@
   init_color_table ();
   bzero (pixel_colors, sizeof pixel_colors);
 
-  for (i = 0; i < gif_color_map->ColorCount; ++i)
-    {
-      int r = gif_color_map->Colors[i].Red << 8;
-      int g = gif_color_map->Colors[i].Green << 8;
-      int b = gif_color_map->Colors[i].Blue << 8;
-      pixel_colors[i] = lookup_rgb_color (f, r, g, b);
-    }
+  if (gif_color_map)
+    for (i = 0; i < gif_color_map->ColorCount; ++i)
+      {
+        int r = gif_color_map->Colors[i].Red << 8;
+        int g = gif_color_map->Colors[i].Green << 8;
+        int b = gif_color_map->Colors[i].Blue << 8;
+        pixel_colors[i] = lookup_rgb_color (f, r, g, b);
+      }
 
 #ifdef COLOR_TABLE_SUPPORT
   img->colors = colors_in_color_table (&img->ncolors);