From 208a3a47fe6f5e4310349f98ce90a77b76f41fbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Wed, 4 Jul 2012 18:09:26 +0200 Subject: [PATCH] don't crash when sound rules are not loaded e.g. when trying to get the gamefiles --- OpenRA.Game/Sound.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OpenRA.Game/Sound.cs b/OpenRA.Game/Sound.cs index 4d2d5cca01..b0e7932b04 100644 --- a/OpenRA.Game/Sound.cs +++ b/OpenRA.Game/Sound.cs @@ -251,7 +251,10 @@ namespace OpenRA { if (definition == null) return false; + if (Rules.Voices == null) return false; + if (Rules.Notifications == null) return false; var rules = (voicedUnit != null) ? Rules.Voices[type] : Rules.Notifications[type]; + if (rules == null) return false; var ID = (voicedUnit != null) ? voicedUnit.ActorID : 0;