From b521eb3fd43c77f04e7de59450d132afd881d6fa Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 9 Jan 2020 18:15:23 +0100 Subject: DIRECTOR: Sanity checks on unsuccessful movie loading --- engines/director/resource.cpp | 6 ++++-- engines/director/score.cpp | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'engines/director') diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp index 2f4f589d72..1123d92e7c 100644 --- a/engines/director/resource.cpp +++ b/engines/director/resource.cpp @@ -63,8 +63,10 @@ Archive *DirectorEngine::openMainArchive(const Common::String movie) { _mainArchive = createArchive(); - if (!_mainArchive->openFile(movie)) - error("openMainArchive(): Could not open '%s'", movie.c_str()); + if (!_mainArchive->openFile(movie)) { + warning("openMainArchive(): Could not open '%s'", movie.c_str()); + return nullptr; + } return _mainArchive; } diff --git a/engines/director/score.cpp b/engines/director/score.cpp index 67eb27b74e..ead93429e0 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -358,13 +358,13 @@ void Score::loadSpriteImages(bool isSharedCast) { Score::~Score() { - if (_surface) + if (_surface && _surface->w) _surface->free(); - if (_trailSurface) + if (_trailSurface && _trailSurface->w) _trailSurface->free(); - if (_backSurface) + if (_backSurface && _backSurface->w) _backSurface->free(); delete _backSurface; -- cgit v1.2.3