diff --git a/coders/gray.c b/coders/gray.c
index 110f026..a3e9139 100644
--- a/coders/gray.c
+++ b/coders/gray.c
@@ -276,7 +276,7 @@
     scene++;
   } while (count == (ssize_t) length);
   quantum_info=DestroyQuantumInfo(quantum_info);
-  InheritException(exception,&canvas_image->exception);
+  InheritException(&image->exception,&canvas_image->exception);
   canvas_image=DestroyImage(canvas_image);
   (void) CloseBlob(image);
   return(GetFirstImageInList(image));