Skip to content

Commit

Permalink
fix crash
Browse files Browse the repository at this point in the history
  • Loading branch information
johzzy committed Dec 6, 2024
1 parent 4b7caee commit 51e1266
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions BGMApp/BGMApp/BGMAudioDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ BGMAudioDevice::~BGMAudioDevice()
bool BGMAudioDevice::CanBeOutputDeviceInBGMApp() const
{
CFStringRef uid = CopyDeviceUID();
assert(uid != nullptr);

bool isNullDevice = CFEqual(uid, CFSTR(kBGMNullDeviceUID));
CFRelease(uid);

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

isBGMDevice =
CFEqual(uid, CFSTR(kBGMDeviceUID)) ||
Expand Down

0 comments on commit 51e1266

Please sign in to comment.