diff options
author | Filippos Karapetis | 2010-10-15 14:33:57 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-10-15 14:33:57 +0000 |
commit | f3270f1957c89f92480c90824714b6574affd774 (patch) | |
tree | 91fe13ae3e5398d247911e26418cef222e663ae8 /engines/sci/engine | |
parent | 5c102d4f082e6e05048cb06e87ff40a17c43207d (diff) | |
download | scummvm-rg350-f3270f1957c89f92480c90824714b6574affd774.tar.gz scummvm-rg350-f3270f1957c89f92480c90824714b6574affd774.tar.bz2 scummvm-rg350-f3270f1957c89f92480c90824714b6574affd774.zip |
SCI: Fixed access to dest in kTextSize() (thanks LordHoto)
svn-id: r53498
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
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; } |