ffStrbufLastIndexC: account for empty strings

#285
This commit is contained in:
Linus Dierheimer
2022-10-11 12:37:54 +02:00
parent cdcac06dbf
commit d54f14a14c
2 changed files with 3 additions and 1 deletions
+3
View File
@@ -184,6 +184,9 @@ static inline FF_C_NODISCARD uint32_t ffStrbufFirstIndexS(const FFstrbuf* strbuf
static inline FF_C_NODISCARD uint32_t ffStrbufLastIndexC(const FFstrbuf* strbuf, char c)
{
if(strbuf->length == 0)
return strbuf->length;
return ffStrbufPreviousIndexC(strbuf, strbuf->length - 1, c);
}