Skip to content
Snippets Groups Projects
Verified Commit 754800d2 authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Guard against servers sending null in the unused fallback keys property

parent f1250b3f
No related branches found
No related tags found
No related merge requests found
Pipeline #3154 failed
......@@ -188,9 +188,9 @@ from_json(const json &obj, Sync &response)
response.device_one_time_keys_count =
obj.at("device_one_time_keys_count").get<std::map<std::string, uint16_t>>();
if (obj.count("device_unused_fallback_key_types") != 0)
response.device_unused_fallback_key_types =
obj.at("device_unused_fallback_key_types").get<std::vector<std::string>>();
if (auto fallback_keys = obj.find("device_unused_fallback_key_types");
fallback_keys != obj.end() && fallback_keys->is_array())
response.device_unused_fallback_key_types = fallback_keys->get<std::vector<std::string>>();
if (obj.count("presence") != 0 && obj.at("presence").contains("events")) {
response.presence =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment