From 9846f374a09667b7121433ab7f2196bfa36e3eb4 Mon Sep 17 00:00:00 2001 From: elexis Date: Wed, 17 Aug 2016 23:11:11 +0000 Subject: [PATCH] Suppress a file not found error and show the placeholder image instead of plain magenta if the mappreview wasn't found. This was SVN commit r18614. --- binaries/data/mods/public/gui/common/functions_utility.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/binaries/data/mods/public/gui/common/functions_utility.js b/binaries/data/mods/public/gui/common/functions_utility.js index 9984cb04cc..8214487b9c 100644 --- a/binaries/data/mods/public/gui/common/functions_utility.js +++ b/binaries/data/mods/public/gui/common/functions_utility.js @@ -149,7 +149,10 @@ function getMapDescriptionAndPreview(mapType, mapName) */ function setMapPreviewImage(guiObject, filename) { - Engine.GetGUIObjectByName(guiObject).sprite = "cropped:" + 400/512+ "," + 300/512 + ":session/icons/mappreview/" + filename; + let path = "session/icons/mappreview/"; + Engine.GetGUIObjectByName(guiObject).sprite = + "cropped:" + 400/512 + "," + 300/512 + ":" + + path + (Engine.FileExists("art/textures/ui/" + path + filename) ? filename : "nopreview.png"); } /**