diff options
| author | Ian MacArthur <imacarthur@gmail.com> | 2010-05-13 07:47:30 +0000 |
|---|---|---|
| committer | Ian MacArthur <imacarthur@gmail.com> | 2010-05-13 07:47:30 +0000 |
| commit | 6efdd851978c5713318feb2470521309343126c9 (patch) | |
| tree | fe0a1350d3595fe8fa382904ac2191ffd4fed32a /src | |
| parent | 5be97a78684886cfdbb68d223f48d1fb11cc55b0 (diff) | |
Make sure that "transparent_c" is not NULL before it is used in win32 builds.
Prevents segfault when loading pixmpas that have no transparent cell set.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7605 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/fl_draw_pixmap.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/fl_draw_pixmap.cxx b/src/fl_draw_pixmap.cxx index f6dd07b3c..f68237a62 100644 --- a/src/fl_draw_pixmap.cxx +++ b/src/fl_draw_pixmap.cxx @@ -222,7 +222,7 @@ int fl_draw_pixmap(const char*const* cdata, int x, int y, Fl_Color bg) { if (!fl_measure_pixmap(cdata, d.w, d.h)) return 0; const uchar*const* data = (const uchar*const*)(cdata+1); int transparent_index = -1; - uchar *transparent_c; // such that transparent_c[0,1,2] are the RGB of the transparent color + uchar *transparent_c = (uchar *)0; // such that transparent_c[0,1,2] are the RGB of the transparent color #ifdef WIN32 color_count = 0; used_colors = (uchar *)malloc(abs(ncolors)*3*sizeof(uchar)); @@ -335,7 +335,10 @@ int fl_draw_pixmap(const char*const* cdata, int x, int y, Fl_Color bg) { } d.data = data; #ifdef WIN32 - make_unused_color(transparent_c[0], transparent_c[1], transparent_c[2]); + if(transparent_c){ + // only make a transparent color if one is defined + make_unused_color(transparent_c[0], transparent_c[1], transparent_c[2]); + } #endif #ifndef __APPLE_QUARTZ__ |
