diff --git a/pdf.c b/pdf.c
index f2121fca28c4e3790f2d77dcf7ddf5d2077e2d15..6bcd7e408759004c4223f4630e5857cea85ad3ef 100644
--- a/pdf.c
+++ b/pdf.c
@@ -4444,16 +4444,25 @@ void parse_xobject(
 					//fprintf(stdout, "\nparse_xobject: Byte Stream = : ");
 					//h_pprintln(stdout, res->ast);
 
-					HBytes stm = H_CAST_BYTES(res->ast);
-					res = h_parse(p_textstream, stm.token, stm.len);
-
-					if (res) { // text found in stream
-						// DEBUG
-						//fprintf(stdout, "\nparse_xobject: Parsing text : ");
-						//h_pprintln(stdout, res->ast);
-
-//						xobj_r->node->xn.dict       = 0;
-						xobj_r->node->xn.textStream = res->ast;
+					/* Text stream is missing from object or failed to parse */
+					if (!res)
+					{
+						xobj_r->node->xn.textStream = NULL;
+						continue;
+					}
+					else
+					{
+						HBytes stm = H_CAST_BYTES(res->ast);
+						res = h_parse(p_textstream, stm.token, stm.len);
+
+						if (res) { // text found in stream
+							// DEBUG
+							//fprintf(stdout, "\nparse_xobject: Parsing text : ");
+							//h_pprintln(stdout, res->ast);
+
+//							xobj_r->node->xn.dict       = 0;
+							xobj_r->node->xn.textStream = res->ast;
+						}
 					}
 				}
 			}