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

This commit is contained in:
李通洲 committed 2024-01-15 15:22:33 +08:00
1 parent c1ed0a4e91
commit 0c844fc342
1 file changed
+2
+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;