From c1787a836803d8e478a81d59403ff9026eed599a Mon Sep 17 00:00:00 2001 From: RoosterDragon Date: Sat, 11 Apr 2015 15:20:16 +0100 Subject: [PATCH] Don't process images with the wrong pixel format in MapCache. --- OpenRA.Game/Map/MapCache.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OpenRA.Game/Map/MapCache.cs b/OpenRA.Game/Map/MapCache.cs index 0303c32795..44bc4a9d9c 100644 --- a/OpenRA.Game/Map/MapCache.cs +++ b/OpenRA.Game/Map/MapCache.cs @@ -11,6 +11,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Net; @@ -174,6 +175,11 @@ namespace OpenRA createdPreview = true; bitmap = Minimap.RenderMapPreview(modData.DefaultRules.TileSets[p.Map.Tileset], p.Map, modData.DefaultRules, true); } + else if (bitmap.PixelFormat != PixelFormat.Format32bppArgb) + { + Log.Write("debug", "Discarding invalid map preview for {0}", p.Uid); + continue; + } // Note: this is not generally thread-safe, but it works here because: // (a) This worker is the only thread writing to this sheet