output/wasapi: SafeTry() catches all exceptions

Fixes crash due to std::stoul() throwing std::invalid_argument.
This commit is contained in:
Max Kellermann 2021-03-05 19:11:57 +01:00
parent 9ff790b7bb
commit 17f7098e27

View File

@ -90,8 +90,8 @@ inline bool SafeTry(Functor &&functor) {
try { try {
functor(); functor();
return true; return true;
} catch (std::runtime_error &err) { } catch (...) {
FormatError(wasapi_output_domain, "%s", err.what()); FormatError(std::current_exception(), "%s");
return false; return false;
} }
} }
@ -101,7 +101,7 @@ inline bool SafeSilenceTry(Functor &&functor) {
try { try {
functor(); functor();
return true; return true;
} catch (std::runtime_error &err) { } catch (...) {
return false; return false;
} }
} }