diff options
Diffstat (limited to 'gcc/ada/a-coorse.adb')
-rw-r--r-- | gcc/ada/a-coorse.adb | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/gcc/ada/a-coorse.adb b/gcc/ada/a-coorse.adb index b7d9d45dc03..668bd739e84 100644 --- a/gcc/ada/a-coorse.adb +++ b/gcc/ada/a-coorse.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2010, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2011, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -532,8 +532,13 @@ package body Ada.Containers.Ordered_Sets is function First (Object : Iterator) return Cursor is begin - return Cursor'( - Object.Container.all'Unrestricted_Access, Object.Container.Tree.First); + if Object.Container = null then + return No_Element; + else + return Cursor'( + Object.Container.all'Unrestricted_Access, + Object.Container.Tree.First); + end if; end First; ------------------- @@ -1142,10 +1147,12 @@ package body Ada.Containers.Ordered_Sets is function Iterate (Container : Set) return Ordered_Set_Iterator_Interfaces.Reversible_Iterator'class is - It : constant Iterator := - (Container'Unchecked_Access, Container.Tree.First); begin - return It; + if Container.Length = 0 then + return Iterator'(null, null); + else + return Iterator'(Container'Unchecked_Access, Container.Tree.First); + end if; end Iterate; function Iterate (Container : Set; Start : Cursor) @@ -1171,7 +1178,7 @@ package body Ada.Containers.Ordered_Sets is function Last (Object : Iterator) return Cursor is begin - if Object.Container.Tree.Last = null then + if Object.Container = null then return No_Element; end if; |