From f3b5765f429ab1039f3fe63c391c0dccf49d3c2e Mon Sep 17 00:00:00 2001 From: OmarHatem Date: Fri, 26 Sep 2025 22:32:49 +0300 Subject: [PATCH] meh. [skip ci] --- cw_zano/lib/zano_wallet_api.dart | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/cw_zano/lib/zano_wallet_api.dart b/cw_zano/lib/zano_wallet_api.dart index 197690c08..0af9af2e2 100644 --- a/cw_zano/lib/zano_wallet_api.dart +++ b/cw_zano/lib/zano_wallet_api.dart @@ -238,16 +238,22 @@ mixin ZanoWalletApi { printV('get_asset_info empty result'); return null; } - final map = jsonDecode(result.body) as Map?; - if (map!['error'] != null) { - printV('get_asset_info $assetId error ${map['error']!['code']} ${map['error']!['message']}'); - return null; - } else if (map['result']!['status']! == 'OK') { - final assetDescriptor = ZanoAsset.fromJson(map['result']!['asset_descriptor']! as Map); - printV('get_asset_info $assetId ${assetDescriptor.fullName} ${assetDescriptor.ticker}'); - return assetDescriptor; - } else { - printV('get_asset_info $assetId status ${map['result']!['status']!}'); + try { + final map = jsonDecode(result.body) as Map?; + if (map!['error'] != null) { + printV( + 'get_asset_info $assetId error ${map['error']!['code']} ${map['error']!['message']}'); + return null; + } else if (map['result']!['status']! == 'OK') { + final assetDescriptor = ZanoAsset.fromJson( + map['result']!['asset_descriptor']! as Map); + printV('get_asset_info $assetId ${assetDescriptor.fullName} ${assetDescriptor.ticker}'); + return assetDescriptor; + } else { + printV('get_asset_info $assetId status ${map['result']!['status']!}'); + return null; + } + } catch (_) { return null; } }