From d45103f2445ed59b7ba78faeae8061327c4ab976 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Tue, 15 May 2018 16:30:58 +1000 Subject: Fixed errors with Event Dispatch and null string pointers --- src/fltk-widgets-groups-input_choices.adb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/fltk-widgets-groups-input_choices.adb') diff --git a/src/fltk-widgets-groups-input_choices.adb b/src/fltk-widgets-groups-input_choices.adb index 366eade..223e33d 100644 --- a/src/fltk-widgets-groups-input_choices.adb +++ b/src/fltk-widgets-groups-input_choices.adb @@ -9,6 +9,7 @@ with use type Interfaces.C.int, + Interfaces.C.Strings.chars_ptr, System.Address; @@ -348,10 +349,16 @@ package body FLTK.Widgets.Groups.Input_Choices is function Get_Input (This : in Input_Choice) - return String is + return String + is + Ptr : Interfaces.C.Strings.chars_ptr := fl_input_choice_get_value (This.Void_Ptr); begin - -- pointer to internal buffer so no free necessary - return Interfaces.C.Strings.Value (fl_input_choice_get_value (This.Void_Ptr)); + if Ptr = Interfaces.C.Strings.Null_Ptr then + return ""; + else + -- pointer to internal buffer so no free necessary + return Interfaces.C.Strings.Value (Ptr); + end if; end Get_Input; -- cgit