diff --git a/pdf.c b/pdf.c
index 897f54da094930f358801db2c37b2cff2c93bb7d..89b8a811bfb20df0038b0220d3899279005e1fa9 100644
--- a/pdf.c
+++ b/pdf.c
@@ -5179,6 +5179,10 @@ p_stream_data__m(HAllocator *mm__, const Dict *dict, struct Env *aux)
 		 *  Explicitly avoid parsing Image objects to improve speed -- send back NULL
 		 */
 		v = dictentry(dict, "Subtype");
+		if (v == NULL) {
+			fprintf(stdout, "\nFailed to parse Subtype of XObject in dictionary");
+			return (NULL);
+		}
 		if (bytes_eq(v->bytes, "Form")) {
 			//fprintf(stdout, "\n\np_stream_data_m:: Found Form XObject\n");
 			//fprintf(stdout, "p_stream_data_m:: Current XObject count = %lu\n", aux->catalog.xoCount);