Add explicit null check

This is needed with edge compiler.

For eng/ide/gnatstudio#423
This commit is contained in:
Anthony Leonardo Gracio
2024-11-12 13:28:22 +00:00
parent 1b5ba868fc
commit e186a7e8e1
3 changed files with 7 additions and 7 deletions

View File

@@ -2236,9 +2236,13 @@ package body Build_Configurations is
Model_Rec : Model_Record;
C : Model_List.Cursor;
Supported : Boolean := True;
Result : Command_Line := Model.Switches.Empty_Command_Line;
Result : Command_Line;
begin
if Model.Switches /= null then
Result := Model.Switches.Empty_Command_Line;
end if;
Result.Append_Switches (Cmd_Line);
if Mode = "" then

View File

@@ -241,13 +241,9 @@ package body Switches_Chooser is
------------------------
function Empty_Command_Line
(Switches : access Switches_Editor_Config_Record'Class)
(Switches : not null access Switches_Editor_Config_Record'Class)
return Command_Lines.Command_Line is
begin
if Switches = null then
return Result : Command_Lines.Command_Line;
end if;
return Result : Command_Lines.Command_Line do
Result.Set_Configuration (Switches.Config);
end return;

View File

@@ -542,7 +542,7 @@ package Switches_Chooser is
-- Switches_Editor_Config object Switches vector length getter
function Empty_Command_Line
(Switches : access Switches_Editor_Config_Record'Class)
(Switches : not null access Switches_Editor_Config_Record'Class)
return Command_Lines.Command_Line;
-- Return empty command line configured using current settings of
-- given Switches_Editor_Config