don't crash when sound rules are not loaded

e.g. when trying to get the gamefiles
This commit is contained in:
Matthias Mailänder
2012-07-04 18:09:26 +02:00
committed by Chris Forbes
parent f0708ecfb2
commit 208a3a47fe

View File

@@ -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;