# HG changeset patch # User Matti Hamalainen # Date 1587013660 -10800 # Node ID 1ef7cdb8a5c1edc06a7ce3b6508199c7d21cc8a5 # Parent 2723cf62d039eda3f8f70a3d7341ce7870ccb907 Check that the source image has a palette when doing image -> palette conversion/extraction. diff -r 2723cf62d039 -r 1ef7cdb8a5c1 tools/gfxconv.c --- a/tools/gfxconv.c Thu Apr 16 07:52:06 2020 +0300 +++ b/tools/gfxconv.c Thu Apr 16 08:07:40 2020 +0300 @@ -2462,6 +2462,11 @@ break; case FFMT_PALETTE: + if (inImage->pal == NULL || inImage->pixfmt != DM_PIXFMT_PALETTE) + { + dmErrorMsg("Source image is not a paletted format or has no palette.\n"); + goto exit; + } res = dmWritePalette(optOutFilename, inImage->pal, &dmPaletteFormatList[optOutFormat]); break;