diff options
Diffstat (limited to 'src/stdlib/c_strings.c')
| -rw-r--r-- | src/stdlib/c_strings.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/stdlib/c_strings.c b/src/stdlib/c_strings.c index 2946ce58..54ea1e40 100644 --- a/src/stdlib/c_strings.c +++ b/src/stdlib/c_strings.c @@ -28,7 +28,8 @@ PUREFUNC public int32_t CString$compare(const void *x, const void *y, const Type if (!*(const char **)x != !*(const char **)y) return (!*(const char **)y) - (!*(const char **)x); - return strcmp(*(const char **)x, *(const char **)y); + const char *x_str = *(const char **)x, *y_str = *(const char **)y; + return (x_str == NULL) || (y_str == NULL) ? (x_str != NULL) - (y_str != NULL) : strcmp(x_str, y_str); } PUREFUNC public bool CString$equal(const void *x, const void *y, const TypeInfo_t *type) { |
