From 1e8f08daab9594c51f87f4efad1f35863fa2a781 Mon Sep 17 00:00:00 2001 From: Stan Bondi Date: Fri, 9 Feb 2024 11:41:25 +0400 Subject: [PATCH] fix(walletd): handle null NFT metadata case (#931) Description --- fix(walletd): handle null NFT metadata case Motivation and Context --- Wallet will now correctly store NFTs with null metadata How Has This Been Tested? --- Manually What process can a PR reviewer use to test or verify this change? --- Breaking Changes --- - [x] None - [ ] Requires data directory to be deleted - [ ] Other - Please specify --- dan_layer/engine_types/src/non_fungible.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dan_layer/engine_types/src/non_fungible.rs b/dan_layer/engine_types/src/non_fungible.rs index a04cae8afb..1c28c3ec4a 100644 --- a/dan_layer/engine_types/src/non_fungible.rs +++ b/dan_layer/engine_types/src/non_fungible.rs @@ -68,7 +68,11 @@ impl NonFungible { } pub fn decode_data(&self) -> Result { - decode_exact(&self.data) + let value = decode_exact::(&self.data)?; + if value.is_null() { + return Ok(Metadata::default()); + } + tari_bor::from_value(&value) } pub fn set_mutable_data(&mut self, mutable_data: Vec) {