From ccec181771fded751233c62677e0815d308c5428 Mon Sep 17 00:00:00 2001 From: NukeBird Date: Thu, 27 Nov 2025 21:14:48 +0300 Subject: [PATCH] Handle NULLs --- axl_string.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/axl_string.cpp b/axl_string.cpp index dc341aa..f79d773 100644 --- a/axl_string.cpp +++ b/axl_string.cpp @@ -2,6 +2,11 @@ u32 axl_strlen(const i8* s) { + if(s == NULL) + { + return 0; + } + u32 len = 0; while(s[len] != '\0') @@ -14,6 +19,11 @@ u32 axl_strlen(const i8* s) i8* axl_strcpy(i8* dst, const i8* src) { + if(dst == NULL || src == NULL) + { + return dst; + } + i8* start = dst; while((*(dst++) = *(src++)) != '\0'); @@ -23,6 +33,11 @@ i8* axl_strcpy(i8* dst, const i8* src) i8* axl_strncpy(i8* dst, const i8* src, u32 n) { + if(dst == NULL || src == NULL) + { + return dst; + } + u32 i = 0; for(; i < n && src[i] != '\0'; i++)