diff options
author | Eugene Sandulenko | 2016-08-02 11:47:21 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | fa7725a5f554bf31c848fccb3d2f8da83dd6f393 (patch) | |
tree | 16d37c8fd2e8c3465a6f76d3c1f7cc8a68bceaec /engines/director/lingo | |
parent | dc498881ef721b9443f64914e9a42bcf5afc967f (diff) | |
download | scummvm-rg350-fa7725a5f554bf31c848fccb3d2f8da83dd6f393.tar.gz scummvm-rg350-fa7725a5f554bf31c848fccb3d2f8da83dd6f393.tar.bz2 scummvm-rg350-fa7725a5f554bf31c848fccb3d2f8da83dd6f393.zip |
DIRECTOR: Lingo: Fix stack underflow on not enough parameters
Diffstat (limited to 'engines/director/lingo')
-rw-r--r-- | engines/director/lingo/lingo-code.cpp | 18 | ||||
-rw-r--r-- | engines/director/lingo/lingo.h | 2 |
2 files changed, 14 insertions, 6 deletions
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp index 344fbc2885..fb1ad93c5d 100644 --- a/engines/director/lingo/lingo-code.cpp +++ b/engines/director/lingo/lingo-code.cpp @@ -55,6 +55,13 @@ void Lingo::push(Datum d) { _stack.push_back(d); } +void Lingo::pushVoid() { + Datum d; + d.u.i = 0; + d.type = VOID; + push(d); +} + Datum Lingo::pop(void) { if (_stack.size() == 0) error("stack underflow"); @@ -692,10 +699,7 @@ void Lingo::c_call() { g_lingo->pop(); // Push dummy value - Datum d; - d.u.i = 0; - d.type = VOID; - g_lingo->push(d); + g_lingo->pushVoid(); return; } @@ -714,8 +718,10 @@ void Lingo::c_call() { for (int i = 0; i < nargs; i++) g_lingo->pop(); - return; - } + g_lingo->pushVoid(); + + return; + } (*sym->u.func)(); return; diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index e15e979bd9..ec2c018926 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -189,6 +189,8 @@ public: int codeFloat(double f); void codeFactory(Common::String &s); + void pushVoid(); + static void c_xpop(); static void c_printtop(); |