diff --git a/pdf.c b/pdf.c
index a7697b557e16a68b17e9e2d35c808a22d0e509fa..ae4efb7cda41a6f3dd668bb740de9e303daf1eac 100644
--- a/pdf.c
+++ b/pdf.c
@@ -4397,8 +4397,12 @@ process_page_content(struct Env *aux)
 
 	/* process the document starting from the /Root object */
 	tok = dictentry(trailer, "Root");
-	if (tok != NULL && tok->token_type == TT_Ref)
-		parse_catalog(aux, tok);
+	if (tok == NULL || tok->token_type != TT_Ref) {
+		log_message(5, "%s: missing or malformed /Root in trailer\n",
+		    aux->infile);
+		return;		// XXX return an error code!
+	}
+	parse_catalog(aux, tok);
 }