diff --git a/pdf.c b/pdf.c
index 8486fc3af98ecf8f75ddecd61e153428fc356901..c08221204c935b21c1ae6e8487b62ea0b740ea8d 100644
--- a/pdf.c
+++ b/pdf.c
@@ -4571,6 +4571,11 @@ void parse_xobject(
 					//fprintf(stdout, "\nparse_xobject: Resource token type = %u\n",rsrcdict_t->token_type);
 					//h_pprintln(stdout, rsrcdict_t);
 
+					if (!rsrcdict_t) {
+						xobj_r->node->xn.textStream = NULL;
+						continue;
+					}
+
 					parse_rsrcdict(xodict->arena, rsrcdict_t, xobj_r->node, aux);
 
 					// set the text state to this xobject