From 92d207ba0f83d513894e23c99bcb8fa5c0aec653 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 26 Feb 2020 20:35:02 +0100 Subject: [PATCH] DIRECTOR: Added sanity checks to func_cursor() --- engines/director/lingo/lingo-funcs.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp index 26e11b79703..581e6b5e99c 100644 --- a/engines/director/lingo/lingo-funcs.cpp +++ b/engines/director/lingo/lingo-funcs.cpp @@ -345,6 +345,15 @@ void Lingo::func_cursor(int c, int m) { return; } + if (score->_loadedCast->getVal(c)->_surface == nullptr) { + warning("cursor: empty sprite %d surface", c); + return; + } + if (score->_loadedCast->getVal(m)->_surface == nullptr) { + warning("cursor: empty sprite %d surface", m); + return; + } + byte *assembly = (byte *)malloc(16 * 16); byte *dst = assembly;