Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix: range error when deleting last Memory from FullScreenMemory

ashilkn8fd2144f6221
diff --git a/lib/ui/home/memories/full_screen_memory.dart b/lib/ui/home/memories/full_screen_memory.dart
index 8321b445b4..303d64915f 100644
--- a/lib/ui/home/memories/full_screen_memory.dart
+++ b/lib/ui/home/memories/full_screen_memory.dart
@@ -66,9 +66,14 @@ class _FullScreenMemoryDataUpdaterState
}
void removeCurrentMemory() {
- setState(() {
- widget.memories.removeAt(indexNotifier.value);
- });
+ widget.memories.removeAt(indexNotifier.value);
+ if (widget.memories.isNotEmpty) {
+ setState(() {
+ if (widget.memories.length == indexNotifier.value) {
+ indexNotifier.value -= 1;
+ }
+ });
+ }
}
@override