Skip to content

Commit

Permalink
Fixed infinite loop with a small wrap width and whitespace at the end…
Browse files Browse the repository at this point in the history
… of the string

Fixes #482
  • Loading branch information
slouken committed Jan 28, 2025
1 parent 930663d commit 3e846d9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/SDL_ttf.c
Original file line number Diff line number Diff line change
Expand Up @@ -3941,6 +3941,9 @@ static bool GetWrappedLines(TTF_Font *font, const char *text, size_t length, TTF
if (numLines > 0) {
strLines[numLines - 1].length = spot - strLines[numLines - 1].text;
}
if (*spot == '\0') {
break;
}
strLines[numLines].text = spot;
strLines[numLines].length = left;
++numLines;
Expand Down

0 comments on commit 3e846d9

Please sign in to comment.