From b085a76e50f60a6d4fa2a34b21d17fb22accb563 Mon Sep 17 00:00:00 2001 From: DavidWyand-GG Date: Mon, 5 Nov 2012 19:16:25 -0500 Subject: [PATCH] Fix for Issue #116 for Crash with unicode --- Engine/source/gfx/gfxFontRenderBatcher.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Engine/source/gfx/gfxFontRenderBatcher.cpp b/Engine/source/gfx/gfxFontRenderBatcher.cpp index cecdd52a2..e782268d0 100644 --- a/Engine/source/gfx/gfxFontRenderBatcher.cpp +++ b/Engine/source/gfx/gfxFontRenderBatcher.cpp @@ -215,12 +215,18 @@ void FontRenderBatcher::queueChar( UTF16 c, S32 ¤tX, GFXVertexColor &curre FontRenderBatcher::SheetMarker & FontRenderBatcher::getSheetMarker( U32 sheetID ) { - // Allocate if it doesn't exist... - if(mSheets.size() <= sheetID || !mSheets[sheetID]) + // Add empty sheets up to and including the requested sheet if necessary + if (mSheets.size() <= sheetID) { - if(sheetID >= mSheets.size()) - mSheets.setSize(sheetID+1); + S32 oldSize = mSheets.size(); + mSheets.setSize( sheetID + 1 ); + for ( S32 i = oldSize; i < mSheets.size(); i++ ) + mSheets[i] = NULL; + } + // Allocate if it doesn't exist... + if (!mSheets[sheetID]) + { S32 size = sizeof( SheetMarker) + mLength * sizeof( CharMarker ); mSheets[sheetID] = (SheetMarker *)mStorage.alloc(size); mSheets[sheetID]->numChars = 0;