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:
parent
98541a6f61
commit
badc152127
@ -1,17 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
ptouch-print - Print labels with images or text on a Brother P-Touch
|
ptouch-print - Print labels with images or text on a Brother P-Touch
|
||||||
|
|
||||||
Copyright (C) 2015-2019 Dominic Radermacher <blip@mockmoon-cybernetics.ch>
|
Copyright (C) 2015-2019 Dominic Radermacher <blip@mockmoon-cybernetics.ch>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it
|
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
|
under the terms of the GNU General Public License version 3 as
|
||||||
published by the Free Software Foundation
|
published by the Free Software Foundation
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, but
|
This program is distributed in the hope that it will be useful, but
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
See the GNU General Public License for more details.
|
See the GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software Foundation,
|
along with this program; if not, write to the Free Software Foundation,
|
||||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
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);
|
printf("error = %04x\n", ptdev->status->error);
|
||||||
exit(0);
|
exit(0);
|
||||||
} else if (strcmp(&argv[i][1], "-image") == 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);
|
out=img_append(out, im);
|
||||||
gdImageDestroy(im);
|
gdImageDestroy(im);
|
||||||
im = NULL;
|
im = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user