Commit 9bf9100fa for imagemagick.org

commit 9bf9100fa0cd520083070ff8094e61623a5bd4d5
Author: Cristy <urban-warrior@imagemagick.org>
Date:   Mon Sep 14 22:14:08 2026 -0400

    https://github.com/ImageMagick/ImageMagick/issues/8957

diff --git a/coders/uhdr.c b/coders/uhdr.c
index 2cd9d3296..bf63037a3 100644
--- a/coders/uhdr.c
+++ b/coders/uhdr.c
@@ -2077,14 +2077,14 @@ next_image:
         if (status != MagickFalse && hdrImgDescriptor.planes[UHDR_PLANE_Y])
         {
           CHECK_IF_ERR(uhdr_enc_set_raw_image(handle, &hdrImgDescriptor, UHDR_HDR_IMG))
-          if (hdr_profile.data_sz != 0)
+          if ((status != MagickFalse) && (hdr_profile.data_sz != 0))
             CHECK_IF_ERR(uhdr_enc_set_exif_data(handle, &hdr_profile))
         }

         if (status != MagickFalse && sdrImgDescriptor.planes[UHDR_PLANE_Y])
         {
           CHECK_IF_ERR(uhdr_enc_set_raw_image(handle, &sdrImgDescriptor, UHDR_SDR_IMG))
-          if (sdr_profile.data_sz != 0)
+          if ((status != MagickFalse) && (sdr_profile.data_sz != 0))
             CHECK_IF_ERR(uhdr_enc_set_exif_data(handle, &sdr_profile))
         }
       }