Fix issue if BString is empty

This commit is contained in:
Patrick Pelissier committed 2025-05-07 21:02:24 +02:00
1 parent 256ff916a2
commit b275859a37
1 file changed
+4
+4
View File
@@ -453,6 +453,10 @@ m_bstring_fwrite(FILE *f, const m_bstring_t v)
{
M_BSTRING_CONTRACT (v);
M_ASSERT (f != NULL);
if (M_UNLIKELY(m_bstring_size(v) == 0)) {
return 0;
}
M_ASSERT(m_bstr1ng_cstr(v) != NULL);
return fwrite(m_bstr1ng_cstr(v), 1, m_bstring_size(v), f);
}