diff options
-rw-r--r-- | engines/sci/gui/gui_gfx.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp index d4fc056308..056bbecdc8 100644 --- a/engines/sci/gui/gui_gfx.cpp +++ b/engines/sci/gui/gui_gfx.cpp @@ -606,11 +606,15 @@ GuiMemoryHandle SciGuiGfx::SaveBits(const Common::Rect &rect, byte screenMask) { } void SciGuiGfx::RestoreBits(GuiMemoryHandle memoryHandle) { - byte *memoryPtr = kmem(_s->_segMan, memoryHandle);; + byte *memoryPtr = NULL; - if (memoryPtr) { - _screen->restoreBits(memoryPtr); - kfree(_s->_segMan, memoryHandle); + if (!memoryHandle.isNull()) { + memoryPtr = kmem(_s->_segMan, memoryHandle);; + + if (memoryPtr) { + _screen->restoreBits(memoryPtr); + kfree(_s->_segMan, memoryHandle); + } } } |