diff --git a/gdb-port/ast.py b/gdb-port/ast.py
index ea9ccf44b88e581665ee83992cf5f62492345cce..892abcbc671ab771613ab853ab5d8c062a0c5199 100644
--- a/gdb-port/ast.py
+++ b/gdb-port/ast.py
@@ -223,7 +223,10 @@ class ASTManager:
 
 	def set_top_node(self, address, parser):
 		# Address has to be an integer or gdb.Value or this will break
-		self.top_node = HParseResult(address)
+		if address == 0:
+			self.top_node = None
+		else:
+			self.top_node = HParseResult(address)
 		# Expected to be a Parser object (probably best to use TopLevelParse for the lookup)
 		self.parser = parser