Fix a null reference exception.
This commit is contained in:
committed by
reaperrr
parent
ff20c1c59d
commit
5fcc049040
@@ -45,7 +45,7 @@ namespace OpenRA
|
|||||||
ISound video;
|
ISound video;
|
||||||
MusicInfo currentMusic;
|
MusicInfo currentMusic;
|
||||||
Dictionary<uint, ISound> currentSounds = new Dictionary<uint, ISound>();
|
Dictionary<uint, ISound> currentSounds = new Dictionary<uint, ISound>();
|
||||||
Dictionary<string, ISound> currentNotifications = new Dictionary<string, ISound>();
|
readonly Dictionary<string, ISound> currentNotifications = new Dictionary<string, ISound>();
|
||||||
public bool DummyEngine { get; private set; }
|
public bool DummyEngine { get; private set; }
|
||||||
|
|
||||||
public Sound(IPlatform platform, SoundSettings soundSettings)
|
public Sound(IPlatform platform, SoundSettings soundSettings)
|
||||||
@@ -392,12 +392,16 @@ namespace OpenRA
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(name) && (p == null || p == p.World.LocalPlayer))
|
if (!string.IsNullOrEmpty(name) && (p == null || p == p.World.LocalPlayer))
|
||||||
{
|
{
|
||||||
if (currentNotifications.ContainsKey(name) && !currentNotifications[name].Complete)
|
if (currentNotifications.ContainsKey(name))
|
||||||
{
|
{
|
||||||
if (pool.AllowInterrupt)
|
var currentNotification = currentNotifications[name];
|
||||||
soundEngine.StopSound(currentNotifications[name]);
|
if (currentNotification != null && !currentNotification.Complete)
|
||||||
else
|
{
|
||||||
return false;
|
if (pool.AllowInterrupt)
|
||||||
|
soundEngine.StopSound(currentNotification);
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (currentSounds.ContainsKey(actorId) && !currentSounds[actorId].Complete)
|
else if (currentSounds.ContainsKey(actorId) && !currentSounds[actorId].Complete)
|
||||||
{
|
{
|
||||||
@@ -407,9 +411,10 @@ namespace OpenRA
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var sound = soundEngine.Play2D(sounds[name],
|
var volume = InternalSoundVolume * volumeModifier * pool.VolumeModifier;
|
||||||
false, relative, pos,
|
var sound = soundEngine.Play2D(sounds[name], false, relative, pos, volume, attenuateVolume);
|
||||||
InternalSoundVolume * volumeModifier * pool.VolumeModifier, attenuateVolume);
|
if (sound == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (voicedActor != null)
|
if (voicedActor != null)
|
||||||
currentSounds[actorId] = sound;
|
currentSounds[actorId] = sound;
|
||||||
|
|||||||
Reference in New Issue
Block a user