summaryrefslogtreecommitdiff
path: root/src/fltk-widgets-menus.adb
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2018-05-15 16:30:58 +1000
committerJed Barber <jjbarber@y7mail.com>2018-05-15 16:30:58 +1000
commitd45103f2445ed59b7ba78faeae8061327c4ab976 (patch)
tree78b9aba4e3d7a303473400b6c809ecf657c4b9e1 /src/fltk-widgets-menus.adb
parent1cd018b440f80601f60908c2e5675413f5c77e25 (diff)
Fixed errors with Event Dispatch and null string pointers
Diffstat (limited to 'src/fltk-widgets-menus.adb')
-rw-r--r--src/fltk-widgets-menus.adb15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/fltk-widgets-menus.adb b/src/fltk-widgets-menus.adb
index d6148f2..03333d2 100644
--- a/src/fltk-widgets-menus.adb
+++ b/src/fltk-widgets-menus.adb
@@ -10,7 +10,8 @@ use type
System.Address,
Interfaces.C.int,
- Interfaces.C.unsigned_long;
+ Interfaces.C.unsigned_long,
+ Interfaces.C.Strings.chars_ptr;
package body FLTK.Widgets.Menus is
@@ -561,10 +562,16 @@ package body FLTK.Widgets.Menus is
function Chosen_Label
(This : in Menu)
- return String is
+ return String
+ is
+ Ptr : Interfaces.C.Strings.chars_ptr := fl_menu_text (This.Void_Ptr);
begin
- -- no dealloc required?
- return Interfaces.C.Strings.Value (fl_menu_text (This.Void_Ptr));
+ if Ptr = Interfaces.C.Strings.Null_Ptr then
+ return "";
+ else
+ -- no dealloc required?
+ return Interfaces.C.Strings.Value (Ptr);
+ end if;
end Chosen_Label;