Skip to content

Commit a47a83c

Browse files
committed
fix crash
1 parent 41e6d8d commit a47a83c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

BGMApp/BGMApp/BGMAudioDevice.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ BGMAudioDevice::~BGMAudioDevice()
5757
bool BGMAudioDevice::CanBeOutputDeviceInBGMApp() const
5858
{
5959
CFStringRef uid = CopyDeviceUID();
60+
assert(uid != nullptr);
61+
6062
bool isNullDevice = CFEqual(uid, CFSTR(kBGMNullDeviceUID));
6163
CFRelease(uid);
6264

@@ -340,6 +342,9 @@ bool BGMAudioDevice::IsBGMDevice(bool inIncludeUISoundsInstance) const
340342
{
341343
// Check the device's UID to see whether it's BGMDevice.
342344
CFStringRef uid = CopyDeviceUID();
345+
if (uid == nullptr) {
346+
return isBGMDevice;
347+
}
343348

344349
isBGMDevice =
345350
CFEqual(uid, CFSTR(kBGMDeviceUID)) ||

0 commit comments

Comments
 (0)