project_files/hwc/rtl/misc.c
changeset 10137 a4537aab4117
parent 10132 701844ed50d3
child 10241 2dc9ff47c5b9
--- a/project_files/hwc/rtl/misc.c	Thu Feb 13 14:12:04 2014 -0500
+++ b/project_files/hwc/rtl/misc.c	Thu Feb 13 23:38:16 2014 +0400
@@ -140,15 +140,22 @@
 string255 fpcrtl_pchar2str(const char *s)
 {
     string255 result;
-    int rlen = strlen(s);
+    
+    if(!s)
+    {
+        result.len = 0;
+    } else
+    {
+        int rlen = strlen(s);
 
-    if(rlen > 255){
-        rlen = 255;
+        if(rlen > 255){
+            rlen = 255;
+        }
+
+        result.len = rlen;
+        memcpy(result.str, s, rlen);
     }
 
-    result.len = rlen;
-    memcpy(result.str, s, rlen);
-
     return result;
 }