diff --git a/pdf.c b/pdf.c
index 5c183b2ad9634762cf61b721ccfc37b79a02ecd1..bb5d4fcbdd4939a64791cca89c3ba03e1e92ba47 100644
--- a/pdf.c
+++ b/pdf.c
@@ -2896,7 +2896,8 @@ init_parser(struct Env *aux)
 int
 check_null_object(const HParsedToken *token)
 {
-	if (token->token_type == TT_BYTES && !strncmp((const char*) token->bytes.token, "null", 4))
+	if ( (token == NULL) || (token->token_type == TT_BYTES &&
+			!strncmp((const char*) token->bytes.token, "null", 4)))
 		return 1;
 	else
 		return 0;