1
0
mirror of https://git.familie-radermacher.ch/linux/ptouch-print.git synced 2025-05-15 00:02:56 +00:00

prevent segfault when image fails to load

This commit is contained in:
Dominic Radermacher 2019-10-27 08:29:43 +01:00
parent 98541a6f61
commit badc152127

View File

@ -491,7 +491,10 @@ int main(int argc, char *argv[])
printf("error = %04x\n", ptdev->status->error);
exit(0);
} else if (strcmp(&argv[i][1], "-image") == 0) {
im=image_load(argv[++i]);
if ((im=image_load(argv[++i])) == NULL) {
printf(_("failed to load image file\n"));
return 1;
}
out=img_append(out, im);
gdImageDestroy(im);
im = NULL;