]> git.saurik.com Git - wxWidgets.git/commitdiff
Crude hack to fix crash for 8bit displays. Seems to work fine. PLEASE CHECK
authorKarsten Ballüder <ballueder@usa.net>
Fri, 7 May 1999 10:51:50 +0000 (10:51 +0000)
committerKarsten Ballüder <ballueder@usa.net>
Fri, 7 May 1999 10:51:50 +0000 (10:51 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2356 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/app.cpp
src/gtk1/app.cpp

index d70f078447afd483af0ffbeac21343333eb2b032..38807e1eb99db27c0bae4a037a3eb8d78a9ca6c2 100644 (file)
@@ -288,18 +288,20 @@ bool wxApp::OnInitGui()
                 int bb = (b << 3) | (b >> 2);
 
                 GdkColor *colors = cmap->colors;
-                int max = 3 * 65536;
-                int index = -1;
+               if(colors)
+               {
+                       int max = 3 * 65536;
+                       int index = -1;
 
-                for (int i = 0; i < cmap->size; i++)
-                {
+                       for (int i = 0; i < cmap->size; i++)
+                        {
                     int rdiff = ((rr << 8) - colors[i].red);
                     int gdiff = ((gg << 8) - colors[i].green);
                     int bdiff = ((bb << 8) - colors[i].blue);
                     int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
                     if (sum < max) { index = i; max = sum; }
                 }
-
+               }
                 m_colorCube[ (r*1024) + (g*32) + b ] = index;
             }
         }
index d70f078447afd483af0ffbeac21343333eb2b032..38807e1eb99db27c0bae4a037a3eb8d78a9ca6c2 100644 (file)
@@ -288,18 +288,20 @@ bool wxApp::OnInitGui()
                 int bb = (b << 3) | (b >> 2);
 
                 GdkColor *colors = cmap->colors;
-                int max = 3 * 65536;
-                int index = -1;
+               if(colors)
+               {
+                       int max = 3 * 65536;
+                       int index = -1;
 
-                for (int i = 0; i < cmap->size; i++)
-                {
+                       for (int i = 0; i < cmap->size; i++)
+                        {
                     int rdiff = ((rr << 8) - colors[i].red);
                     int gdiff = ((gg << 8) - colors[i].green);
                     int bdiff = ((bb << 8) - colors[i].blue);
                     int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
                     if (sum < max) { index = i; max = sum; }
                 }
-
+               }
                 m_colorCube[ (r*1024) + (g*32) + b ] = index;
             }
         }