summaryrefslogtreecommitdiff
path: root/src/guiTable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/guiTable.cpp')
-rw-r--r--src/guiTable.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/guiTable.cpp b/src/guiTable.cpp
index 3cc95ce4f..6b33b8266 100644
--- a/src/guiTable.cpp
+++ b/src/guiTable.cpp
@@ -565,10 +565,8 @@ void GUITable::setSelected(s32 index)
--index; // Switch from 1-based indexing to 0-based indexing
s32 rowcount = m_rows.size();
- if (rowcount == 0) {
+ if (rowcount == 0 || index < 0) {
return;
- } else if (index < 0) {
- index = 0;
} else if (index >= rowcount) {
index = rowcount - 1;
}