--- readPNG.c	Thu Jan 10 11:14:16 2002
+++ readPNG.c.new	Thu Jan 10 11:13:59 2002
@@ -288,8 +288,11 @@
 	}
 
 	/* We set up the normal PNG error routines, then override with longjmp. */
-	png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
-		NULL, NULL, NULL);
+	if ((png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL)) == NULL)
+	{
+		/* failed, too bad */
+		return((XmHTMLRawImageData*)NULL);
+	}
 
 	/* Create and initialize the info structure */
 	if((info_ptr = png_create_info_struct(png_ptr)) == NULL)
