diff options
author | uruk | 2014-08-13 17:54:35 +0200 |
---|---|---|
committer | uruk | 2014-08-13 17:54:35 +0200 |
commit | 45e8078dab1be71a9ef5d125fa80ff660aa0cd5c (patch) | |
tree | bc05a9c73dd9f98cfdc316454dcc85fffa5c4b3d /engines/cge2 | |
parent | 3e8041d54bc87b5dd8eae5e260e1fe1985ea1dd4 (diff) | |
download | scummvm-rg350-45e8078dab1be71a9ef5d125fa80ff660aa0cd5c.tar.gz scummvm-rg350-45e8078dab1be71a9ef5d125fa80ff660aa0cd5c.tar.bz2 scummvm-rg350-45e8078dab1be71a9ef5d125fa80ff660aa0cd5c.zip |
CGE2: Don't allow Sprite::step() to dereference nullptr-s.
Diffstat (limited to 'engines/cge2')
-rw-r--r-- | engines/cge2/vga13h.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/engines/cge2/vga13h.cpp b/engines/cge2/vga13h.cpp index 9141f426f3..db96682237 100644 --- a/engines/cge2/vga13h.cpp +++ b/engines/cge2/vga13h.cpp @@ -516,7 +516,7 @@ void Sprite::step(int nr) { if (nr >= 0) _seqPtr = nr; - if (_ext) { + if (_ext && _ext->_seq) { V3D p = _pos3D; Seq *seq = nullptr; @@ -556,13 +556,15 @@ void Sprite::step(int nr) { gotoxyz(p); } else { seq = _ext->_seq + _seqPtr; - if (seq->_dz == 127 && seq->_dx != 0) { - _vm->_commandHandlerTurbo->addCommand(kCmdSound, -1, 256 * seq->_dy + seq->_dx, this); - } else { - p._x += seq->_dx; - p._y += seq->_dy; - p._z += seq->_dz; - gotoxyz(p); + if (seq) { + if (seq->_dz == 127 && seq->_dx != 0) { + _vm->_commandHandlerTurbo->addCommand(kCmdSound, -1, 256 * seq->_dy + seq->_dx, this); + } else { + p._x += seq->_dx; + p._y += seq->_dy; + p._z += seq->_dz; + gotoxyz(p); + } } } if (seq && (seq->_dly >= 0)) |