Use Null-Propagation Operator
This commit is contained in:
@@ -326,17 +326,13 @@ namespace OpenRA.Platforms.Default
|
||||
|
||||
public void StopSound(ISound sound)
|
||||
{
|
||||
if (sound == null)
|
||||
return;
|
||||
|
||||
((OpenAlSound)sound).Stop();
|
||||
((OpenAlSound)sound)?.Stop();
|
||||
}
|
||||
|
||||
public void StopAllSounds()
|
||||
{
|
||||
foreach (var slot in sourcePool.Values)
|
||||
if (slot.Sound != null)
|
||||
slot.Sound.Stop();
|
||||
slot.Sound?.Stop();
|
||||
}
|
||||
|
||||
public void SetListenerPosition(WPos position)
|
||||
|
||||
@@ -415,8 +415,7 @@ namespace OpenRA.Platforms.Default
|
||||
|
||||
disposed = true;
|
||||
|
||||
if (context != null)
|
||||
context.Dispose();
|
||||
context?.Dispose();
|
||||
|
||||
if (Window != IntPtr.Zero)
|
||||
SDL.SDL_DestroyWindow(Window);
|
||||
|
||||
@@ -260,8 +260,7 @@ namespace OpenRA.Platforms.Default
|
||||
var localResult = result;
|
||||
result = null;
|
||||
|
||||
if (localEdi != null)
|
||||
localEdi.Throw();
|
||||
localEdi?.Throw();
|
||||
return localResult;
|
||||
}
|
||||
}
|
||||
@@ -278,8 +277,7 @@ namespace OpenRA.Platforms.Default
|
||||
void QueueMessage(Message message)
|
||||
{
|
||||
var exception = messageException;
|
||||
if (exception != null)
|
||||
exception.Throw();
|
||||
exception?.Throw();
|
||||
|
||||
lock (messages)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user