diff --git a/pdf.c b/pdf.c
index fb8876be9c43b67e5753d6e85a7776c033de2f76..6ed644c26e38d5bbfb39a652282d78a360db8385 100644
--- a/pdf.c
+++ b/pdf.c
@@ -4984,8 +4984,8 @@ parse_xrefs(struct Env *aux)
 
 	// Process the trailer dictionary
 	const HParsedToken *root = dictentry(trailer, "Root");
-	assert(root->token_type == TT_Ref);
-	parse_catalog(aux, root);
+	if(root != NULL && root->token_type == TT_Ref)
+		parse_catalog(aux, root);
 
 	return;
 }