diff --git a/lib/src/pages/read/read_page_logic.dart b/lib/src/pages/read/read_page_logic.dart index e1761b37..17fe1e1e 100644 --- a/lib/src/pages/read/read_page_logic.dart +++ b/lib/src/pages/read/read_page_logic.dart @@ -522,9 +522,14 @@ class ReadPageLogic extends GetxController { /// for some reason like slow loading of some image, [ItemPositions] may be not in index order, and even some of /// them are not in viewport List _filterAndSortItems(Iterable positions) { - positions = positions.where((item) => !(item.itemTrailingEdge < 0 || item.itemLeadingEdge > 1)).toList(); - (positions as List).sort((a, b) => a.index - b.index); - return positions; + List actualPositions = positions.where((item) => !(item.itemTrailingEdge < 0 || item.itemLeadingEdge > 1)).toList(); + actualPositions.sort((a, b) => a.index - b.index); + + if (actualPositions.isEmpty) { + Log.upload(StateError('NoItemPosition!'), stackTrace: StackTrace.current, extraInfos: {'positions': positions}); + } + + return actualPositions; } double _getVisibleHeight() { diff --git a/lib/src/pages/setting/account/login/login_page_logic.dart b/lib/src/pages/setting/account/login/login_page_logic.dart index ab06021c..4764814e 100644 --- a/lib/src/pages/setting/account/login/login_page_logic.dart +++ b/lib/src/pages/setting/account/login/login_page_logic.dart @@ -103,8 +103,18 @@ class LoginPageLogic extends GetxController { return; } - int ipbMemberId = int.parse(match.group(1)!); - String ipbPassHash = match.group(2)!; + int ipbMemberId; + String ipbPassHash; + try { + ipbMemberId = int.parse(match.group(1)!); + ipbPassHash = match.group(2)!; + } on Exception catch (e) { + Log.error('loginFail'.tr, e); + Log.upload(e); + snack('loginFail'.tr, 'cookieFormatError'.tr); + return; + } + await cookieManager.storeEhCookiesForAllUri([ Cookie('ipb_member_id', ipbMemberId.toString()), Cookie('ipb_pass_hash', ipbPassHash), diff --git a/lib/src/service/gallery_download_service.dart b/lib/src/service/gallery_download_service.dart index 4f69ff13..ed27ee53 100644 --- a/lib/src/service/gallery_download_service.dart +++ b/lib/src/service/gallery_download_service.dart @@ -807,7 +807,9 @@ class GalleryDownloadService extends GetxController { } bool _taskHasBeenPausedOrRemoved(GalleryDownloadedData gallery) { - return gid2DownloadProgress[gallery.gid] == null || gid2DownloadProgress[gallery.gid]!.downloadStatus == DownloadStatus.paused; + return gid2DownloadProgress[gallery.gid] == null || + gid2DownloadProgress[gallery.gid]!.downloadStatus == DownloadStatus.paused || + gid2ImageHrefs[gallery.gid] == null; } static void ensureDownloadDirExists() {