From afc376ddaa4ee6bc1c245a86ff6eff38a8e8d2d0 Mon Sep 17 00:00:00 2001
From: pompolic <pompolic@special-circumstanc.es>
Date: Thu, 23 Jun 2022 19:35:37 +0200
Subject: [PATCH] Don't try to initialize a HParseResult if h_do_parse returns
 NULL

---
 gdb-port/ast.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gdb-port/ast.py b/gdb-port/ast.py
index ea9ccf4..892abcb 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
 
-- 
GitLab