소스 검색

Prevents GFXDrawUtil::drawTextN() from drawing one character more than requested if in_string has more than n characters.

OTHGMars 8 년 전
부모
커밋
5349bf226b
1개의 변경된 파일2개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 3
      Engine/source/gfx/gfxDrawUtil.cpp

+ 2 - 3
Engine/source/gfx/gfxDrawUtil.cpp

@@ -148,9 +148,8 @@ U32 GFXDrawUtil::drawTextN( GFont *font, const Point2I &ptDraw, const UTF8 *in_s
       return ptDraw.x;
 
    // Convert to UTF16 temporarily.
-   n++; // space for null terminator
-   FrameTemp<UTF16> ubuf( n );
-   convertUTF8toUTF16N(in_string, ubuf, n);
+   FrameTemp<UTF16> ubuf( n + 1 ); // (n+1) to add space for null terminator
+   convertUTF8toUTF16N(in_string, ubuf, n + 1);
 
    return drawTextN( font, ptDraw, ubuf, n, colorTable, maxColorIndex, rot );
 }