Author: mlytwyn
Date: Mon May 16 19:24:26 2016
New Revision: 39771

URL: http://svn.gna.org/viewcvs/gnustep?rev=39771&view=rev
Log:
Try to address real problem of unknown crash

Modified:
    libs/back/branches/gnustep_testplant_branch/Source/gsc/gscolors.c

Modified: libs/back/branches/gnustep_testplant_branch/Source/gsc/gscolors.c
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/back/branches/gnustep_testplant_branch/Source/gsc/gscolors.c?rev=39771&r1=39770&r2=39771&view=diff
==============================================================================
--- libs/back/branches/gnustep_testplant_branch/Source/gsc/gscolors.c   
(original)
+++ libs/back/branches/gnustep_testplant_branch/Source/gsc/gscolors.c   Mon May 
16 19:24:26 2016
@@ -280,35 +280,38 @@
            Temp = (r < g ? r : g);
            Temp = (b < Temp ? b : Temp);
            diff = V - Temp;
-           if (V == r)
-             {
-          if (diff == 0.0)
+      
+      // TESTPLANT-MAL-05162016: customer getting crashes in this
+      // code somehwere - only case I can find that could cause one
+      // is V == 0...
+      if (V == 0.0)
+        {
+          _hue_component = 0;
+          _saturation_component = 0;
+          _brightness_component = r;
+        }
+        else
+        {
+          if (V == r)
             {
-              // Invoke same code as r=g=b above...
-              H = 0;
-              // diff == 0 so diff/V == 0
-              // V already == r
+              H = (g - b)/diff;
+            }
+          else if (V == g)
+            {
+              H = (b - r)/diff + 2;
             }
           else
             {
-              H = (g - b)/diff;
+              H = (r - g)/diff + 4;
             }
-             }
-           else if (V == g)
-             {
-               H = (b - r)/diff + 2;
-             }
-           else
-             {
-               H = (r - g)/diff + 4;
-             }
-           if (H < 0)
-             {
-               H += 6;
-             }
-           _hue_component = H/6;
-           _saturation_component = diff/V;
-           _brightness_component = V;
+          if (H < 0)
+            {
+              H += 6;
+            }
+          _hue_component = H/6;
+          _saturation_component = diff/V;
+          _brightness_component = V;
+        }
          }
        color->field[0] = _hue_component;
        color->field[1] = _saturation_component;


_______________________________________________
Gnustep-cvs mailing list
Gnustep-cvs@gna.org
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to