Mercurial > hg > dmlib
changeset 2461:1ef7cdb8a5c1
Check that the source image has a palette when doing image -> palette conversion/extraction.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 16 Apr 2020 08:07:40 +0300 |
parents | 2723cf62d039 |
children | 5ec5918c6198 |
files | tools/gfxconv.c |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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;