diff --git a/pdf.c b/pdf.c
index d1738eee723695d643e23433f7d00f8ae742ba8f..53ae22f853733caf5427ddca59b7c9fc231c4022 100644
--- a/pdf.c
+++ b/pdf.c
@@ -1913,7 +1913,8 @@ act_txtobj(const HParseResult *p, void *u)
 		txte = H_CAST(TextEntry, opstream->seq->elements[i]);
 
 		// make sure we are working on the same node as the current node
-		assert(txte && (txte->node == node));
+		assert(txte != NULL);
+		assert(txte->node == node);
 
 		switch (txte->type) {
 		// text state operators
@@ -2018,7 +2019,10 @@ act_txtobj(const HParseResult *p, void *u)
 	// Now concatenate the pieces
 	for (int i =0; i < opstream->seq->used; i++) {
 		txte = H_CAST(TextEntry, opstream->seq->elements[i]);
+		assert(txte != NULL);
+		assert(txte->node == node);
 		ts   = &txte->node->ts;
+		assert(ts->node == node);
 
 		// Process the text operators
 		switch (txte->type) {