From 2a94c72df919f89e3cc5245d54ce141a9ba81a23 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Sat, 25 May 2024 14:16:30 +0200 Subject: [PATCH] try catch? --- src/chat_gui4.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/chat_gui4.cpp b/src/chat_gui4.cpp index 7c0d6e2..18ecd56 100644 --- a/src/chat_gui4.cpp +++ b/src/chat_gui4.cpp @@ -1,5 +1,6 @@ #include "./chat_gui4.hpp" +#include #include #include #include @@ -26,6 +27,7 @@ #include #include #include +#include #include namespace Components { @@ -164,7 +166,15 @@ void ChatGui4::setClipboardData(std::vector mime_types, std::shared // release lock, since on some platforms the callback is called immediatly } - SDL_SetClipboardData(clipboard_callback, nullptr, this, tmp_mimetype_list.data(), tmp_mimetype_list.size()); + try { + SDL_SetClipboardData(clipboard_callback, nullptr, this, tmp_mimetype_list.data(), tmp_mimetype_list.size()); + } catch (const std::runtime_error& e) { + std::cerr << "CG error: setting clipboard data threw runtime_error!\n"; + } catch (const std::exception& e) { + std::cerr << "CG error: setting clipboard data threw exception!\n"; + } catch (...) { + std::cerr << "CG error: setting clipboard data threw!\n"; + } } ChatGui4::ChatGui4(