1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-25 10:43:13 +02:00

fix(mobile): invalid range on label builder crash timeline (#3759)

* fix(mobile): invalid date on label builder crash timeline

* actual fix

---------

Co-authored-by: Alex Tran <Alex.Tran@conductix.com>
This commit is contained in:
Alex 2023-08-17 23:50:41 -05:00 committed by GitHub
parent 2de30e34f4
commit 28d3d3e679
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -300,7 +300,13 @@ class ImmichAssetGridViewState extends State<ImmichAssetGridView> {
} }
Text _labelBuilder(int pos) { Text _labelBuilder(int pos) {
final date = widget.renderList.elements[pos].date; final maxLength = widget.renderList.elements.length;
if (pos < 0 || pos >= maxLength) {
return const Text("");
}
final date = widget.renderList.elements[pos % maxLength].date;
return Text( return Text(
DateFormat.yMMMM().format(date), DateFormat.yMMMM().format(date),
style: const TextStyle( style: const TextStyle(
@ -335,7 +341,8 @@ class ImmichAssetGridViewState extends State<ImmichAssetGridView> {
itemBuilder: _itemBuilder, itemBuilder: _itemBuilder,
itemPositionsListener: _itemPositionsListener, itemPositionsListener: _itemPositionsListener,
itemScrollController: _itemScrollController, itemScrollController: _itemScrollController,
itemCount: widget.renderList.elements.length + (widget.topWidget != null ? 1 : 0), itemCount: widget.renderList.elements.length +
(widget.topWidget != null ? 1 : 0),
addRepaintBoundaries: true, addRepaintBoundaries: true,
); );