]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve gif_load error messages
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 11 Apr 2022 10:32:55 +0000 (12:32 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 11 Apr 2022 10:32:55 +0000 (12:32 +0200)
* src/image.c (gif_load): Improve error reporting (bug#54848).

src/image.c

index e3e540e5e28967d68b50c1e6ff53b8b8e2292e60..3f9111a7093a248c3a72b3b78eced812e1d2bd8c 100644 (file)
@@ -8754,10 +8754,21 @@ gif_load (struct frame *f, struct image *img)
   rc = DGifSlurp (gif);
   if (rc == GIF_ERROR || gif->ImageCount <= 0)
     {
-      if (NILP (specified_data))
-       image_error ("Error reading `%s'", img->spec);
+#if HAVE_GIFERRORSTRING
+      const char *errstr = GifErrorString (gif->Error);
+      if (errstr)
+       if (NILP (specified_data))
+         image_error ("Error reading `%s' (%s)", img->spec,
+                      build_string (errstr));
+       else
+         image_error ("Error reading GIF data: %s",
+                      build_string (errstr));
       else
-       image_error ("Error reading GIF data");
+#endif
+       if (NILP (specified_data))
+         image_error ("Error reading `%s'", img->spec);
+       else
+         image_error ("Error reading GIF data");
       goto gif_error;
     }