From f3270f1957c89f92480c90824714b6574affd774 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 15 Oct 2010 14:33:57 +0000 Subject: SCI: Fixed access to dest in kTextSize() (thanks LordHoto) svn-id: r53498 --- engines/sci/engine/kgraphics.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 9ef2025337..282ca0f842 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -341,6 +341,11 @@ reg_t kTextSize(EngineState *s, int argc, reg_t *argv) { int maxwidth = (argc > 3) ? argv[3].toUint16() : 0; int font_nr = argv[2].toUint16(); + if (!dest) { + debugC(2, kDebugLevelStrings, "GetTextSize: Empty destination"); + return s->r_acc; + } + Common::String sep_str; const char *sep = NULL; if ((argc > 4) && (argv[4].segment)) { @@ -350,9 +355,8 @@ reg_t kTextSize(EngineState *s, int argc, reg_t *argv) { dest[0] = dest[1] = NULL_REG; - if (text.empty() || !dest) { // Empty text - if (dest) - dest[2] = dest[3] = make_reg(0, 0); + if (text.empty()) { // Empty text + dest[2] = dest[3] = make_reg(0, 0); debugC(2, kDebugLevelStrings, "GetTextSize: Empty string"); return s->r_acc; } -- cgit v1.2.3