Skip to content

High performance self-hosted photo and video management solution.

Fixed mobile timeline crash when date group cannot be parsed (#530)

Alexbf2760ffefb2
diff --git a/mobile/lib/modules/home/views/home_page.dart b/mobile/lib/modules/home/views/home_page.dart
index 6c9362c13e..46a6c29d74 100644
--- a/mobile/lib/modules/home/views/home_page.dart
+++ b/mobile/lib/modules/home/views/home_page.dart
@@ -65,37 +65,45 @@ class HomePage extends HookConsumerWidget {
int? lastMonth;
assetGroupByDateTime.forEach((dateGroup, immichAssetList) {
- DateTime parseDateGroup = DateTime.parse(dateGroup);
- int currentMonth = parseDateGroup.month;
-
- if (lastMonth != null) {
- if (currentMonth - lastMonth! != 0) {
- imageGridGroup.add(
- MonthlyTitleText(
- isoDate: dateGroup,
- ),
- );
+ try {
+ DateTime parseDateGroup = DateTime.parse(dateGroup);
+ int currentMonth = parseDateGroup.month;
+
+ if (lastMonth != null) {
+ if (currentMonth - lastMonth! != 0) {
+ imageGridGroup.add(
+ MonthlyTitleText(
+ isoDate: dateGroup,
+ ),
+ );
+ }
}
- }
- imageGridGroup.add(
- DailyTitleText(
- key: Key('${dateGroup.toString()}title'),
- isoDate: dateGroup,
- assetGroup: immichAssetList,
- ),
- );
-
- imageGridGroup.add(
- ImageGrid(
- assetGroup: immichAssetList,
- sortedAssetGroup: sortedAssetList,
- tilesPerRow: appSettingService.getSetting(AppSettingsEnum.tilesPerRow),
- showStorageIndicator: appSettingService.getSetting(AppSettingsEnum.storageIndicator),
- ),
- );
+ imageGridGroup.add(
+ DailyTitleText(
+ key: Key('${dateGroup.toString()}title'),
+ isoDate: dateGroup,
+ assetGroup: immichAssetList,
+ ),
+ );
+
+ imageGridGroup.add(
+ ImageGrid(
+ assetGroup: immichAssetList,
+ sortedAssetGroup: sortedAssetList,
+ tilesPerRow:
+ appSettingService.getSetting(AppSettingsEnum.tilesPerRow),
+ showStorageIndicator: appSettingService
+ .getSetting(AppSettingsEnum.storageIndicator),
+ ),
+ );
- lastMonth = currentMonth;
+ lastMonth = currentMonth;
+ } catch (e) {
+ debugPrint(
+ "[ERROR] Cannot parse $dateGroup - Wrong create date format : ${immichAssetList.map((asset) => asset.createdAt).toList()}",
+ );
+ }
});
}