浏览代码

Merge pull request #2007 from OTHGMars/DrawTextNFix

BugFix for GFXDrawUtil::drawTextN()
Areloch 8 年之前
父节点
当前提交
b0fe71fa2f
共有 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 );
 }