checked if text is empty to return early

This commit is contained in:
DissolveDZ 2023-09-30 18:44:46 +02:00
parent dc86f5e04a
commit beab63887c

View File

@ -1430,7 +1430,7 @@ bool TextIsEqual(const char *text1, const char *text2)
// Get a piece of a text string // Get a piece of a text string
const char *TextSubtext(const char *text, int position, int length) const char *TextSubtext(const char *text, int position, int length)
{ {
if (!length) if (!length || !text)
return ""; return "";
int textLength = TextLength(text); int textLength = TextLength(text);
if (position >= textLength) if (position >= textLength)