]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Tue, 14 Jan 2014 15:03:18 +0000 (15:03 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Tue, 14 Jan 2014 15:03:18 +0000 (15:03 +0000)
MagickCore/widget.c
MagickCore/xwindow.c

index db56bf5811c71a6d69ec4d493c20c687ddae57a4..21676c72a38ffd4f171ea3de2c77a41305c675fa 100644 (file)
@@ -2254,8 +2254,9 @@ MagickPrivate void XColorBrowserWidget(Display *display,XWindows *windows,
             /*
               User pressed mode button.
             */
-            (void) CopyMagickString(reply_info.text,mode_info.text,
-              MaxTextExtent);
+            if (mode_info.text != (char *) NULL)
+              (void) CopyMagickString(reply_info.text,mode_info.text,
+                MaxTextExtent);
             (void) CopyMagickString(primary_selection,reply_info.text,
               MaxTextExtent);
             (void) XSetSelectionOwner(display,XA_PRIMARY,windows->widget.id,
index 3d7fe2324f43bc2de09557f2026d9519dd4fe326..95d8ba1f3c5a635327f6eeb6a9d0387078253d12 100644 (file)
@@ -4434,17 +4434,20 @@ static Image *XGetWindowImage(Display *display,const Window window,
                 {
                   pixel=XGetPixel(ximage,x,y);
                   color=(pixel >> red_shift) & red_mask;
-                  color=(65535UL*color)/red_mask;
-                  SetPixelRed(composite_image,
-                    ScaleShortToQuantum((unsigned short) color),q);
+                  if (red_mask != 0)
+                    color=(65535UL*color)/red_mask;
+                  SetPixelRed(composite_image,ScaleShortToQuantum(
+                    (unsigned short) color),q);
                   color=(pixel >> green_shift) & green_mask;
-                  color=(65535UL*color)/green_mask;
-                  SetPixelGreen(composite_image,
-                    ScaleShortToQuantum((unsigned short) color),q);
+                  if (green_mask != 0)
+                    color=(65535UL*color)/green_mask;
+                  SetPixelGreen(composite_image,ScaleShortToQuantum(
+                    (unsigned short) color),q);
                   color=(pixel >> blue_shift) & blue_mask;
-                  color=(65535UL*color)/blue_mask;
-                  SetPixelBlue(composite_image,
-                    ScaleShortToQuantum((unsigned short) color),q);
+                  if (blue_mask != 0)
+                    color=(65535UL*color)/blue_mask;
+                  SetPixelBlue(composite_image,ScaleShortToQuantum(
+                    (unsigned short) color),q);
                   q+=GetPixelChannels(composite_image);
                 }
                 status=SyncCacheViewAuthenticPixels(composite_view,exception);