changeset 78746:8090732dfc6d

(gif_load): Fix bug: Handle nonexistent colormap.
author Thien-Thi Nguyen <ttn@gnuvola.org>
date Thu, 06 Sep 2007 20:27:32 +0000
parents 853738fb50ec
children 2f5f0065fee6
files src/image.c
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/image.c	Thu Sep 06 07:01:41 2007 +0000
+++ b/src/image.c	Thu Sep 06 20:27:32 2007 +0000
@@ -7878,13 +7878,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);