From 9f1240d8d95eeb7fc17e746355cf6ace1577a4ee Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sat, 27 Mar 2021 14:03:46 +0000 Subject: [PATCH] Only construct JSON object if it's useful --- src/db/models/cipher.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/db/models/cipher.rs b/src/db/models/cipher.rs index da3eabab..365865f8 100644 --- a/src/db/models/cipher.rs +++ b/src/db/models/cipher.rs @@ -104,7 +104,7 @@ impl Cipher { // Get the type_data or a default to an empty json object '{}'. // If not passing an empty object, mobile clients will crash. - let mut type_data_json: Value = serde_json::from_str(&self.data).unwrap_or(json!({})); + let mut type_data_json: Value = serde_json::from_str(&self.data).unwrap_or_else(|_| json!({})); // NOTE: This was marked as *Backwards Compatibilty Code*, but as of January 2021 this is still being used by upstream // Set the first element of the Uris array as Uri, this is needed several (mobile) clients.