SL: Fix move down exception.

mesh
Pierre-Antoine Rouby 2023-07-26 13:26:41 +02:00
parent a9b905a039
commit 003be29eca
2 changed files with 3 additions and 3 deletions

View File

@ -284,7 +284,7 @@ class SedimentLayer(SQLSubModel):
self.delete(els)
def move_up(self, index):
if index < len(self._layers):
if index >= 0:
next = index - 1
l = self._layers
@ -293,7 +293,7 @@ class SedimentLayer(SQLSubModel):
self._status.modified()
def move_down(self, index):
if index >= 0:
if index + 1 < len(self._layers):
prev = index + 1
l = self._layers

View File

@ -134,7 +134,7 @@ class TableModel(QAbstractTableModel):
self.layoutChanged.emit()
def move_down(self, row, parent=QModelIndex()):
if row > len(self._sl):
if row + 1 >= len(self._sl):
return
target = row