Browse Source

handle text overflow; fixes crash when using SDL 1.2 (#59)

M-HT 6 years ago
parent
commit
e3ca8622ef
1 changed files with 4 additions and 1 deletions
  1. 4 1
      text.c

+ 4 - 1
text.c

@@ -878,6 +878,9 @@ PAL_DrawText(
    urect.h = (fUse8x8Font ? 8 : PAL_FontHeight()) + (fShadow ? 1 : 0);
    urect.w = 0;
 
+   // Handle text overflow
+   if (rect.x >= 320) return;
+
    while (*lpszText)
    {
       //
@@ -1914,7 +1917,7 @@ PAL_swprintf(
   Purpose:
 
     Formatted wide-character output conversion that output Chinese characters correctly.
-	This function supported a subset of format strings that are commonly supported by 
+	This function supported a subset of format strings that are commonly supported by
 	various C libraries, which can be formalized as following:
 
 	%[flags] [width] [.precision] [{h | l | ll}] type