From 3033eb8be0198f097f6852d1a1fb8e14dc9991f1 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Mon, 25 Feb 2013 18:51:44 +1300 Subject: [PATCH] Die with a helpful error if a palette doesn't exist. --- OpenRA.Game/Graphics/WorldRenderer.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenRA.Game/Graphics/WorldRenderer.cs b/OpenRA.Game/Graphics/WorldRenderer.cs index 442b0001f6..45ba653799 100644 --- a/OpenRA.Game/Graphics/WorldRenderer.cs +++ b/OpenRA.Game/Graphics/WorldRenderer.cs @@ -52,7 +52,11 @@ namespace OpenRA.Graphics PaletteReference CreatePaletteReference(string name) { - return new PaletteReference(name, palette.GetPaletteIndex(name), palette.GetPalette(name)); + var pal = palette.GetPalette(name); + if (pal == null) + throw new InvalidOperationException("Palette `{0}` does not exist".F(name)); + + return new PaletteReference(name, palette.GetPaletteIndex(name), pal); } public PaletteReference Palette(string name) { return palettes[name]; }