diff --git a/src/database.rs b/src/database.rs index 31c1b21..2cdb040 100644 --- a/src/database.rs +++ b/src/database.rs @@ -78,12 +78,14 @@ impl EntryValue { } } -// unsafe unwraps! impl std::fmt::Display for EntryValue { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let (entry_type, entry_value) = match self { EntryValue::Address(address) => ("ADDRESS", address.to_string()), - EntryValue::Value(value) => ("VALUE", serde_json::to_string(value).unwrap()), + EntryValue::Value(value) => ( + "VALUE", + serde_json::to_string(value).unwrap_or_else(|_| String::from("?!?!?!")), + ), EntryValue::Invalid => ("INVALID", "INVALID".to_string()), }; write!(f, "{}: {}", entry_type, entry_value)