changeset 2210:fa5e74384d87

Check for non-existing palette when reading palette from image file.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 14 Jun 2019 05:35:20 +0300
parents 7a0af15fbe97
children ef9b55c879d6
files tools/lib64util.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tools/lib64util.c	Fri Jun 14 05:32:58 2019 +0300
+++ b/tools/lib64util.c	Fri Jun 14 05:35:20 2019 +0300
@@ -170,7 +170,13 @@
             goto done;
         }
 
-        res = dmPaletteCopy(ppal, inImage->pal);
+        if (inImage->pal != NULL)
+            res = dmPaletteCopy(ppal, inImage->pal);
+        else
+        {
+            dmErrorMsg("Image file does not have a palette.\n");
+            res = DMERR_NULLPTR;
+        }
     }
     else
     if (dmPaletteProbeGeneric(dataBuf, dataSize, &pfmt, &index) > 0 &&