summaryrefslogtreecommitdiff
path: root/src/fltk-widgets-groups-windows.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-groups-windows.adb
parent1cd018b440f80601f60908c2e5675413f5c77e25 (diff)
Fixed errors with Event Dispatch and null string pointers
Diffstat (limited to 'src/fltk-widgets-groups-windows.adb')
-rw-r--r--src/fltk-widgets-groups-windows.adb25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/fltk-widgets-groups-windows.adb b/src/fltk-widgets-groups-windows.adb
index a4da35b..590c915 100644
--- a/src/fltk-widgets-groups-windows.adb
+++ b/src/fltk-widgets-groups-windows.adb
@@ -10,6 +10,7 @@ use type
Interfaces.C.int,
Interfaces.C.unsigned,
+ Interfaces.C.Strings.chars_ptr,
System.Address;
@@ -490,10 +491,16 @@ package body FLTK.Widgets.Groups.Windows is
function Get_Icon_Label
(This : in Window)
- return String is
+ return String
+ is
+ Ptr : Interfaces.C.Strings.chars_ptr := fl_window_get_iconlabel (This.Void_Ptr);
begin
- -- pointer to internal buffer only, so no Free required
- return Interfaces.C.Strings.Value (fl_window_get_iconlabel (This.Void_Ptr));
+ if Ptr = Interfaces.C.Strings.Null_Ptr then
+ return "";
+ else
+ -- pointer to internal buffer only, so no Free required
+ return Interfaces.C.Strings.Value (Ptr);
+ end if;
end Get_Icon_Label;
@@ -600,10 +607,16 @@ package body FLTK.Widgets.Groups.Windows is
function Get_Label
(This : in Window)
- return String is
+ return String
+ is
+ Ptr : Interfaces.C.Strings.chars_ptr := fl_window_get_label (This.Void_Ptr);
begin
- -- pointer to internal buffer only, so no Free required
- return Interfaces.C.Strings.Value (fl_window_get_label (This.Void_Ptr));
+ if Ptr = Interfaces.C.Strings.Null_Ptr then
+ return "";
+ else
+ -- pointer to internal buffer only, so no Free required
+ return Interfaces.C.Strings.Value (Ptr);
+ end if;
end Get_Label;