From 17f7098e2754d916da6ee1e48909af8ab2f3e574 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Fri, 5 Mar 2021 19:11:57 +0100
Subject: [PATCH] output/wasapi: SafeTry() catches all exceptions

Fixes crash due to std::stoul() throwing std::invalid_argument.
---
 src/output/plugins/wasapi/WasapiOutputPlugin.cxx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/output/plugins/wasapi/WasapiOutputPlugin.cxx b/src/output/plugins/wasapi/WasapiOutputPlugin.cxx
index 58a12918d..13ddb3f1e 100644
--- a/src/output/plugins/wasapi/WasapiOutputPlugin.cxx
+++ b/src/output/plugins/wasapi/WasapiOutputPlugin.cxx
@@ -90,8 +90,8 @@ inline bool SafeTry(Functor &&functor) {
 	try {
 		functor();
 		return true;
-	} catch (std::runtime_error &err) {
-		FormatError(wasapi_output_domain, "%s", err.what());
+	} catch (...) {
+		FormatError(std::current_exception(), "%s");
 		return false;
 	}
 }
@@ -101,7 +101,7 @@ inline bool SafeSilenceTry(Functor &&functor) {
 	try {
 		functor();
 		return true;
-	} catch (std::runtime_error &err) {
+	} catch (...) {
 		return false;
 	}
 }