Added check for numeric ids and null pointers (thanks to Dimitrie).

diff --git a/library/debug.c b/library/debug.c
index d8fae8d..6f183db 100644
--- a/library/debug.c
+++ b/library/debug.c
@@ -187,6 +187,13 @@
 {
     char *dst, *res;
 
+    if (!HIWORD(str))
+    {
+        if (!str) return "(null)";
+        res = get_tmp_space( 6 );
+        sprintf( res, "#%04x", LOWORD(str) );
+        return res;
+    }
     if (n == -1) n = strlen(str);
     if (n < 0) n = 0;
     else if (n > 200) n = 200;
@@ -231,6 +238,13 @@
 {
     char *dst, *res;
 
+    if (!HIWORD(str))
+    {
+        if (!str) return "(null)";
+        res = get_tmp_space( 6 );
+        sprintf( res, "#%04x", LOWORD(str) );
+        return res;
+    }
     if (n == -1) n = strlenW(str);
     if (n < 0) n = 0;
     else if (n > 200) n = 200;