FFstrbuf: don't crash with ffStrbufInitStatic(&buf, NULL)

This commit is contained in:
李通洲
2024-01-15 15:11:04 +08:00
parent c1ed0a4e91
commit 0c844fc342
+2
View File
@@ -223,6 +223,8 @@ FF_C_NODISCARD static inline FFstrbuf ffStrbufCreate()
static inline void ffStrbufInitStatic(FFstrbuf* strbuf, const char* str)
{
ffStrbufInit(strbuf);
if (!str) return;
strbuf->allocated = 0;
strbuf->length = (uint32_t) strlen(str);
strbuf->chars = (char*) str;