aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/graphics/text32.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/engines/sci/graphics/text32.cpp b/engines/sci/graphics/text32.cpp
index 7375fdeffd..181dabc9a8 100644
--- a/engines/sci/graphics/text32.cpp
+++ b/engines/sci/graphics/text32.cpp
@@ -505,12 +505,12 @@ int16 GfxText32::getTextWidth(const uint index, uint length) const {
if (length > 0 && currentChar == 'f') {
GuiResourceId fontId = 0;
- do {
+ while (length > 0 && *text >= '0' && *text <= '9') {
currentChar = *text++;
--length;
fontId = fontId * 10 + currentChar - '0';
- } while (length > 0 && *text >= '0' && *text <= '9');
+ }
if (length > 0) {
font = _cache->getFont(fontId);