Fix NREs in QueryDevices by bailing out early.
This commit is contained in:
@@ -56,6 +56,12 @@ namespace OpenRA.Platforms.Default
|
||||
|
||||
var devices = new List<string>();
|
||||
var next = ALC10.alcGetString(IntPtr.Zero, type);
|
||||
if (next == IntPtr.Zero || AL10.alGetError() != AL10.AL_NO_ERROR)
|
||||
{
|
||||
Log.Write("sound", "Failed to query OpenAL device list using {0}", label);
|
||||
return new string[] { };
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
var str = Marshal.PtrToStringAnsi(next);
|
||||
@@ -63,12 +69,6 @@ namespace OpenRA.Platforms.Default
|
||||
devices.Add(str);
|
||||
} while (Marshal.ReadByte(next) != 0);
|
||||
|
||||
if (AL10.alGetError() != AL10.AL_NO_ERROR)
|
||||
{
|
||||
Log.Write("sound", "Failed to query OpenAL device list using {0}", label);
|
||||
return new string[] { };
|
||||
}
|
||||
|
||||
return devices.ToArray();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user