]> git.lizzy.rs Git - minetest.git/blobdiff - src/guiTable.cpp
Refactor Game class (part 2) (#5422)
[minetest.git] / src / guiTable.cpp
index 3cc95ce4fcde25bc9fba53900f7680775e2569b5..6b33b8266b5d7d5ea1c1852012f574691555feaa 100644 (file)
@@ -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;
        }