diff --git a/agpl-cr-mutable_assignment.adb b/agpl-cr-mutable_assignment.adb index fe9a35c..1c7796f 100644 --- a/agpl-cr-mutable_assignment.adb +++ b/agpl-cr-mutable_assignment.adb @@ -45,7 +45,7 @@ with Ada.Numerics.Generic_Elementary_Functions; package body Agpl.Cr.Mutable_Assignment is - Expensive_Checks : constant Boolean := True; + Expensive_Checks : constant Boolean := False; File : constant String := "[Mutable_Assignment] "; diff --git a/agpl-htn-plan-utils.adb b/agpl-htn-plan-utils.adb index ad1c654..5fe493a 100644 --- a/agpl-htn-plan-utils.adb +++ b/agpl-htn-plan-utils.adb @@ -74,8 +74,11 @@ package body Agpl.Htn.Plan.Utils is Parent : Subplan; Reindex_Needed : Boolean := False; begin - pragma Assert (Get_Kind (Node) = Task_Node); - loop + if Node /= null then + pragma Assert (Get_Kind (Node) = Task_Node); + null; + end if; + while Node /= null loop if Get_Kind (Node) = Or_Node then Parent := Get_Parent (Node); -- Replace the OR node by the branch we were arriving from. diff --git a/agpl-htn-plan.adb b/agpl-htn-plan.adb index 38e6329..5dc115d 100644 --- a/agpl-htn-plan.adb +++ b/agpl-htn-plan.adb @@ -401,7 +401,11 @@ package body Agpl.Htn.Plan is is use Plan_Node.Task_Id_To_Node; begin - return Element (Find (This.Index, Id)); + if This.Index.Contains (Id) then + return This.Index.Element (Id); + else + return null; + end if; end Get_Node; -------------- diff --git a/agpl-htn-plan.ads b/agpl-htn-plan.ads index c0bcc60..28d86fb 100644 --- a/agpl-htn-plan.ads +++ b/agpl-htn-plan.ads @@ -111,6 +111,7 @@ package Agpl.Htn.Plan is (This : in Object; Id : in Tasks.Task_Id) return Subplan; -- Get the branch starting at the given task. + -- May be null if the task isn't in the tree function Get_Root (This : in Object) return Subplan; -- Get the root node.