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-dialogs.adb | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'src/fltk-dialogs.adb') diff --git a/src/fltk-dialogs.adb b/src/fltk-dialogs.adb index 7f0629c..349fd1f 100644 --- a/src/fltk-dialogs.adb +++ b/src/fltk-dialogs.adb @@ -168,7 +168,11 @@ package body FLTK.Dialogs is Interfaces.C.To_C (Default)); begin -- string does not need dealloc - return Interfaces.C.Strings.Value (Result); + if Result = Interfaces.C.Strings.Null_Ptr then + return ""; + else + return Interfaces.C.Strings.Value (Result); + end if; end Text_Input; @@ -189,7 +193,11 @@ package body FLTK.Dialogs is Interfaces.C.To_C (Default)); begin -- string does not need dealloc - return Interfaces.C.Strings.Value (Result); + if Result = Interfaces.C.Strings.Null_Ptr then + return ""; + else + return Interfaces.C.Strings.Value (Result); + end if; end Password; @@ -248,7 +256,11 @@ package body FLTK.Dialogs is Boolean'Pos (Relative)); begin -- I'm... fairly sure the string does not need dealloc? - return Interfaces.C.Strings.Value (Result); + if Result = Interfaces.C.Strings.Null_Ptr then + return ""; + else + return Interfaces.C.Strings.Value (Result); + end if; end Dir_Chooser; @@ -264,7 +276,11 @@ package body FLTK.Dialogs is Boolean'Pos (Relative)); begin -- I'm... fairly sure the string does not need dealloc? - return Interfaces.C.Strings.Value (Result); + if Result = Interfaces.C.Strings.Null_Ptr then + return ""; + else + return Interfaces.C.Strings.Value (Result); + end if; end File_Chooser; -- cgit