Remove access to NULL pointer.
authorMario de Sousa <msousa@fe.up.pt>
Wed, 25 Apr 2012 15:56:45 +0100
changeset 532 cb78940b2cb8
parent 531 e7d6f28fc882
child 533 dd93707c482e
Remove access to NULL pointer.
stage3/lvalue_check.cc
--- a/stage3/lvalue_check.cc	Wed Apr 25 15:46:53 2012 +0100
+++ b/stage3/lvalue_check.cc	Wed Apr 25 15:56:45 2012 +0100
@@ -371,7 +371,13 @@
 /* B 2.1 Instructions and Operands */
 /***********************************/
 void *lvalue_check_c::visit(il_instruction_c *symbol) {
-	symbol->il_instruction->accept(*this);
+	/* il_instruction will be NULL when parsing a label with no instruction
+	 * e.g.:   label1:          <---- il_instruction = NULL!
+	 *                 LD 33
+	 *                 ...
+	 */
+	if (NULL != symbol->il_instruction)
+		symbol->il_instruction->accept(*this);
 	return NULL;
 }