From 181055b62a3084b569b19861d49fa3035888594a Mon Sep 17 00:00:00 2001 From: Thanasis Antoniou Date: Wed, 18 Sep 2019 22:52:31 +0300 Subject: BLADERUNNER: Fix crash for some devices for Android SDL port This is a work around that is confirmed to be working Reference ticket is here: https://bugs.scummvm.org/ticket/11149 --- engines/bladerunner/bladerunner.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp index 76a95ab5d8..f4032b8009 100644 --- a/engines/bladerunner/bladerunner.cpp +++ b/engines/bladerunner/bladerunner.cpp @@ -326,7 +326,17 @@ Common::Error BladeRunnerEngine::run() { return Common::Error(Common::kNoGameDataFoundError, missingFileStr); } - _screenPixelFormat = g_system->getSupportedFormats().front(); + Common::List tmpSupportedFormatsList = g_system->getSupportedFormats(); + if (!tmpSupportedFormatsList.empty()) { + _screenPixelFormat = tmpSupportedFormatsList.front(); + } else { + // Workaround for reported issue whereby in the AndroidSDL port + // some devices would crash with a segmentation fault due to an empty supported formats list. + // TODO: A better fix for getSupportedFormats() - maybe figure why in only some device it might return an empty list + // + // Use this as a fallback format - Should be a format supported by Android port + _screenPixelFormat = Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0); + } debug("Using pixel format: %s", _screenPixelFormat.toString().c_str()); initGraphics(640, 480, &_screenPixelFormat); -- cgit v1.2.3