diff options
Diffstat (limited to 'alc/alc.cpp')
-rw-r--r-- | alc/alc.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index 691b9274..0851305a 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -1217,18 +1217,28 @@ void ProbeAllDevicesList() DO_INITCONFIG(); std::lock_guard<std::recursive_mutex> _{ListLock}; - alcAllDevicesList.clear(); - if(PlaybackFactory) - PlaybackFactory->probe(DevProbe::Playback, &alcAllDevicesList); + if(!PlaybackFactory) + decltype(alcAllDevicesList){}.swap(alcAllDevicesList); + else + { + std::string names{PlaybackFactory->probe(DevProbe::Playback)}; + if(names.empty()) names += '\0'; + names.swap(alcAllDevicesList); + } } void ProbeCaptureDeviceList() { DO_INITCONFIG(); std::lock_guard<std::recursive_mutex> _{ListLock}; - alcCaptureDeviceList.clear(); - if(CaptureFactory) - CaptureFactory->probe(DevProbe::Capture, &alcCaptureDeviceList); + if(!CaptureFactory) + decltype(alcCaptureDeviceList){}.swap(alcCaptureDeviceList); + else + { + std::string names{CaptureFactory->probe(DevProbe::Capture)}; + if(names.empty()) names += '\0'; + names.swap(alcCaptureDeviceList); + } } } // namespace |