diff --git a/native/cocos/editor-support/spine/SpineString.cpp b/native/cocos/editor-support/spine/SpineString.cpp index c86cfc439f2..617bbc10f6c 100644 --- a/native/cocos/editor-support/spine/SpineString.cpp +++ b/native/cocos/editor-support/spine/SpineString.cpp @@ -55,7 +55,8 @@ String::String(const char *chars, size_t len, bool own) { } } -String::String(const char *chars, bool own/* = false*/): String(chars, strlen(chars), own) { +String::String(const char *chars, bool own/* = false*/) + : String(chars, (chars ? strlen(chars) : 0), own) { } String::String(const String &other) {