From 315912fb92b1123bd67a28c7fd0b8c3a4f261f25 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Thu, 6 Sep 2007 20:28:40 +0000 Subject: [PATCH] (gif_load): Fix bug: Handle nonexistent colormap. --- src/ChangeLog | 4 ++++ src/image.c | 15 ++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index ad81e6c63f4..1d13b2955e4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2007-09-06 Pixel (tiny change) + + * image.c (gif_load): Fix bug: Handle nonexistent colormap. + 2007-09-06 Glenn Morris * gtkutil.c (menu_grab_callback) : diff --git a/src/image.c b/src/image.c index 91cb7eb570e..cd70166c295 100644 --- a/src/image.c +++ b/src/image.c @@ -7878,13 +7878,14 @@ gif_load (f, img) 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); -- 2.39.2