[fractal/fractal-next] explore: Fix crash when removing non-existant item



commit fbc867e03170a32fefe065ac384597b52bfdd351
Author: Kévin Commaille <zecakeh tedomum fr>
Date:   Sat Dec 25 16:44:32 2021 +0100

    explore: Fix crash when removing non-existant item
    
    Fixes #805

 src/session/content/explore/public_room_list.rs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/session/content/explore/public_room_list.rs b/src/session/content/explore/public_room_list.rs
index 1428d3d5..f144e224 100644
--- a/src/session/content/explore/public_room_list.rs
+++ b/src/session/content/explore/public_room_list.rs
@@ -240,7 +240,11 @@ impl PublicRoomList {
                     (position - 1, 0, added)
                 }
             } else {
-                (position, 1, added)
+                if position == 0 {
+                    (position, 0, added)
+                } else {
+                    (position - 1, 1, added)
+                }
             }
         };
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]