Handle NULL pchar in pchar2astr
authorunc0rr
Mon, 19 Nov 2018 22:25:02 +0100
changeset 14271 a7320c65f484
parent 14270 06f2dc4deab2
child 14272 fa2e3f123a09
Handle NULL pchar in pchar2astr
project_files/hwc/rtl/misc.c
--- a/project_files/hwc/rtl/misc.c	Mon Nov 19 21:51:46 2018 +0100
+++ b/project_files/hwc/rtl/misc.c	Mon Nov 19 22:25:02 2018 +0100
@@ -162,6 +162,12 @@
 astring fpcrtl_pchar2astr(const char *s)
 {
     astring result;
+
+    if(!s) {
+        result.len = 0;
+        return result;
+    }
+
     int rlen = strlen(s);
 
     if(rlen > MAX_ANSISTRING_LENGTH){