minor fix [skip ci]
OmarHatem committed
Apr 11, 2025 at 14:13 UTC
c0283a37ee300c8aee45e7cb4fa318cf4fdcd1f5
1 file changed
+11
-7
cw_decred/lib/wallet.dart
+11
-7
@@ -710,14 +710,18 @@ abstract class DecredWalletBase
710
// walletBirthdayBlockHeight checks if the wallet birthday is set and returns
711
// it. Returns -1 if not.
712
Future<int> walletBirthdayBlockHeight() async {
713
- final res = await _libwallet.birthState(walletInfo.name);
714
- final decoded = json.decode(res);
715
- // Having these values set indicates that sync has not reached the birthday
716
- // yet, so no birthday is set.
717
- if (decoded["setfromheight"] == true || decoded["setfromtime"] == true) {
718
- return -1;
713
+ try {
714
+ final res = await _libwallet.birthState(walletInfo.name);
715
+ final decoded = json.decode(res);
716
+ // Having these values set indicates that sync has not reached the birthday
717
+ // yet, so no birthday is set.
718
+ if (decoded["setfromheight"] == true || decoded["setfromtime"] == true) {
719
+ return -1;
720
+ }
721
+ return decoded["height"] ?? 0;
722
+ } on FormatException catch (_) {
723
+ return 0;
724
}
720
- return decoded["height"] ?? 0;
725
}
726
727
Future<bool> verifyMessage(String message, String signature, {String? address = null}) async {