1
0
mirror of https://git.familie-radermacher.ch/linux/ptouch-print.git synced 2025-05-13 23:32:59 +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

@ -1,17 +1,17 @@
/*
ptouch-print - Print labels with images or text on a Brother P-Touch
Copyright (C) 2015-2019 Dominic Radermacher <blip@mockmoon-cybernetics.ch>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 3 as
published by the Free Software Foundation
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@ -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;