Mercurial > hg > dmlib
comparison tools/lib64util.c @ 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 | 90ec1ec89c56 |
children | 5db6e0b63b35 |
comparison
equal
deleted
inserted
replaced
2209:7a0af15fbe97 | 2210:fa5e74384d87 |
---|---|
168 dmErrorMsg("Could not read image file: %s\n", | 168 dmErrorMsg("Could not read image file: %s\n", |
169 dmErrorStr(res)); | 169 dmErrorStr(res)); |
170 goto done; | 170 goto done; |
171 } | 171 } |
172 | 172 |
173 res = dmPaletteCopy(ppal, inImage->pal); | 173 if (inImage->pal != NULL) |
174 res = dmPaletteCopy(ppal, inImage->pal); | |
175 else | |
176 { | |
177 dmErrorMsg("Image file does not have a palette.\n"); | |
178 res = DMERR_NULLPTR; | |
179 } | |
174 } | 180 } |
175 else | 181 else |
176 if (dmPaletteProbeGeneric(dataBuf, dataSize, &pfmt, &index) > 0 && | 182 if (dmPaletteProbeGeneric(dataBuf, dataSize, &pfmt, &index) > 0 && |
177 pfmt->read != NULL) | 183 pfmt->read != NULL) |
178 { | 184 { |