aboutsummaryrefslogtreecommitdiff
path: root/src/guiTable.cpp
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2016-10-02 15:44:53 +0200
committersfan5 <sfan5@live.de>2016-10-02 15:49:18 +0200
commiteb0e9d5661e28cdd4f59b96f7ab269fbf67bdc34 (patch)
tree6e80a7a9de0b71b49387ce4eae19dabbed18e8bd /src/guiTable.cpp
parent3a95054db5c44a3fea6a27d5633f668539e67870 (diff)
downloadminetest-eb0e9d5661e28cdd4f59b96f7ab269fbf67bdc34.tar.gz
minetest-eb0e9d5661e28cdd4f59b96f7ab269fbf67bdc34.tar.bz2
minetest-eb0e9d5661e28cdd4f59b96f7ab269fbf67bdc34.zip
Allow nothing to be selected from formspec parameters
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;
}