From a7e157c036511f1db96719e5f6ac966087e7c657 Mon Sep 17 00:00:00 2001 From: Hiddify Date: Sun, 1 Oct 2023 16:25:07 +0200 Subject: [PATCH] new: add support of some exception panel with zero usage --- lib/domain/profiles/profile.dart | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/domain/profiles/profile.dart b/lib/domain/profiles/profile.dart index 10b0c9bf..b3630917 100644 --- a/lib/domain/profiles/profile.dart +++ b/lib/domain/profiles/profile.dart @@ -159,14 +159,13 @@ class SubscriptionInfo with _$SubscriptionInfo { } int _fromJsonTotal(dynamic total) { - if (total == null) { - return 9223372036854775807; - } - return total as int; + final totalInt = total as int? ?? -1; + return totalInt > 0 ? totalInt : 9223372036854775807; } DateTime _dateTimeFromSecondsSinceEpoch(dynamic expire) { + final expireInt = expire as int? ?? -1; return DateTime.fromMillisecondsSinceEpoch( - (expire as int? ?? 92233720368) * 1000, + (expireInt > 0 ? expireInt : 92233720368) * 1000, ); }