diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2020-08-21 00:42:46 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2020-08-21 00:42:46 -0400 |
commit | 6f11aa4dae4c7334b150752f5cf8d270ce746d9c (patch) | |
tree | 45d7ed1776b9294ce5a0f89f872aff5e21a1f425 /discord/websocket.cpp | |
parent | a201d5905ad9188e890eeb0cc0aee8d4fb9dcf3c (diff) | |
download | abaddon-portaudio-6f11aa4dae4c7334b150752f5cf8d270ce746d9c.tar.gz abaddon-portaudio-6f11aa4dae4c7334b150752f5cf8d270ce746d9c.zip |
shitty MESSAGE_CREATE handling
Diffstat (limited to 'discord/websocket.cpp')
-rw-r--r-- | discord/websocket.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/discord/websocket.cpp b/discord/websocket.cpp index b867368..8232ac6 100644 --- a/discord/websocket.cpp +++ b/discord/websocket.cpp @@ -39,7 +39,13 @@ void Websocket::OnMessage(const ix::WebSocketMessagePtr &msg) { // printf("%s\n", msg->str.substr(0, 1000).c_str()); //else // printf("%s\n", msg->str.c_str()); - auto obj = nlohmann::json::parse(msg->str); + nlohmann::json obj; + try { + obj = nlohmann::json::parse(msg->str); + } catch (std::exception &e) { + printf("Error decoding JSON. Discarding message: %s\n", e.what()); + return; + } if (m_json_callback) m_json_callback(obj); } break; |