fookb: Fix error handling when reading XPM files.

Previously, we would try and read the width and height of images read from
an XPM file *before* doing any error handling to determine whether we
successfully read the file in the first place.  If there had been an error,
then there would be a segfault.
This commit is contained in:
Doug Torrance 2017-09-09 21:24:25 -04:00 committed by Carlos R. Mafra
parent 279eb3c3fe
commit b8ce2c9cd2

View file

@ -38,6 +38,9 @@ static int get_one_image(char *name, int index, Display *dpy)
foo = XpmReadFileToImage(dpy, name, &stupid_picture[index],
NULL, NULL);
if (foo < 0)
return foo;
if (0 == w) {
w = stupid_picture[index]->width;
if (0 == w) {