From 8177c4596d0d14ec8634a90a13ab83a3032b23e5 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Mon, 18 Oct 2021 19:47:25 +0200 Subject: vhdl-configuration.adb: avoid a crash in case of error. Fix #1897 --- src/vhdl/vhdl-configuration.adb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/vhdl/vhdl-configuration.adb b/src/vhdl/vhdl-configuration.adb index d45cfc1b2..6eb427af9 100644 --- a/src/vhdl/vhdl-configuration.adb +++ b/src/vhdl/vhdl-configuration.adb @@ -102,7 +102,9 @@ package body Vhdl.Configuration is end if; if Flag_Load_All_Design_Units then + -- Load and analyze UNIT. Load_Design_Unit (Unit, From); + -- TODO: exit now in case of error ? end if; -- Add packages from depend list. @@ -170,8 +172,15 @@ package body Vhdl.Configuration is when Iir_Kind_Architecture_Body => -- Add entity -- find all entity/architecture/configuration instantiation - Add_Design_Unit (Get_Design_Unit (Get_Entity (Lib_Unit)), Loc); - Add_Design_Concurrent_Stmts (Lib_Unit); + declare + Ent : constant Iir := Get_Entity (Lib_Unit); + begin + if Ent /= Null_Iir then + -- In case of errors. + Add_Design_Unit (Get_Design_Unit (Ent), Loc); + end if; + Add_Design_Concurrent_Stmts (Lib_Unit); + end; when Iir_Kinds_Verification_Unit => Add_Verification_Unit_Items (Lib_Unit); when Iir_Kind_Entity_Declaration -- cgit v1.2.3