Allow nothing to be selected from formspec parameters
authorsfan5 <sfan5@live.de>
Sun, 2 Oct 2016 13:44:53 +0000 (15:44 +0200)
committersfan5 <sfan5@live.de>
Sun, 2 Oct 2016 13:49:18 +0000 (15:49 +0200)
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;
        }