diff --git a/MagickCore/xwindow.c b/MagickCore/xwindow.c
index a9ec377..29a1907 100644
--- a/MagickCore/xwindow.c
+++ b/MagickCore/xwindow.c
@@ -5614,12 +5614,9 @@
           window->shared_memory=MagickFalse;
           if (status != False)
             XShmDetach(display,&segment_info[1]);
-          if (ximage != (XImage *) NULL)
-            {
-              ximage->data=NULL;
-              XDestroyImage(ximage);
-              ximage=(XImage *) NULL;
-            }
+          ximage->data=NULL;
+          XDestroyImage(ximage);
+          ximage=(XImage *) NULL;
           if (segment_info[1].shmid >= 0)
             {
               if (segment_info[1].shmaddr != NULL)