diff --git a/pdf.c b/pdf.c
index c2c6f7dd5d1f67a8c39e0360a5e37cdcbfe9d301..7070077ddb5503c176316ad62aa6b6d83ee870ff 100644
--- a/pdf.c
+++ b/pdf.c
@@ -194,7 +194,10 @@ pp_parseresult(FILE *stream, const HParsedToken *tok, int indent, int delta)
 {
 	HParseResult *res = H_CAST(HParseResult, tok);
 
-	h_pprint(stream, res->ast, indent, delta);
+	if (res == NULL)
+		fprintf(stream, "null");
+	else
+		h_pprint(stream, res->ast, indent, delta);
 }
 
 void