@@ -120,8 +120,9 @@ filterByIndex :: (Int -> Bool) -> [a] -> [a]
120120filterByIndex p = map snd . filter (\(i, _) -> p i) . zip [0..]
121121
122122swapRows :: (RowIndex, RowIndex) -> (Model, Table) -> (Model, TableDiff)
123−swapRows (a, b) (m, t) = (m, PatchIntMap $ point a b <> point b a)
123+swapRows (a, b) (m, t) = (m, PatchIntMap $ if max a b < length t then swap else empty)
124124 where
125+ swap = point a b <> point b a
125126 point x y = singleton (fst (val x)) $ Just $ snd $ val y
126127 val = (assocs t !!)
127128