From 71adea7748865870ef50f2f712b5df9f9d742886 Mon Sep 17 00:00:00 2001
From: r0hit05 <rohitsutradhar311@gmail.com>
Date: Tue, 11 Oct 2022 13:21:04 +0530
Subject: [PATCH] Added checks for voip struct CallCandidates

---
 lib/structs/events/voip.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/structs/events/voip.cpp b/lib/structs/events/voip.cpp
index f75b08b17..6cd1a390b 100644
--- a/lib/structs/events/voip.cpp
+++ b/lib/structs/events/voip.cpp
@@ -79,9 +79,12 @@ to_json(json &obj, const CallInvite &content)
 void
 from_json(const json &obj, CallCandidates::Candidate &content)
 {
-    content.sdpMid        = obj.at("sdpMid").get<std::string>();
-    content.sdpMLineIndex = obj.at("sdpMLineIndex").get<uint16_t>();
-    content.candidate     = obj.at("candidate").get<std::string>();
+    if(obj.contains("sdpMid"))
+        content.sdpMid        = obj.at("sdpMid").get<std::string>();
+    if(obj.contains("sdpMLineIndex"))
+        content.sdpMLineIndex = obj.at("sdpMLineIndex").get<uint16_t>();
+    if(obj.contains("candidate"))
+        content.candidate     = obj.at("candidate").get<std::string>();
 }
 
 void
-- 
GitLab