mirror of
https://git.suyu.dev/suyu/discord-rpc.git
synced 2025-12-27 09:46:57 +01:00
Do/wrap error checking around json reading
This commit is contained in:
parent
6774b5d881
commit
ef60ec40c3
3 changed files with 57 additions and 21 deletions
|
|
@ -114,9 +114,8 @@ bool RpcConnection::Read(JsonDocument& message)
|
|||
switch (readFrame.opcode) {
|
||||
case Opcode::Close: {
|
||||
message.ParseInsitu(readFrame.message);
|
||||
lastErrorCode = message["code"].GetInt();
|
||||
const auto& m = message["message"];
|
||||
StringCopy(lastErrorMessage, m.GetString());
|
||||
lastErrorCode = GetIntMember(&message, "code");
|
||||
StringCopy(lastErrorMessage, GetStrMember(&message, "message", ""));
|
||||
Close();
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue