From: sfan5 Date: Sun, 2 Oct 2016 13:44:53 +0000 (+0200) Subject: Allow nothing to be selected from formspec parameters X-Git-Tag: 0.4.15~218 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=eb0e9d5661e28cdd4f59b96f7ab269fbf67bdc34;p=oweals%2Fminetest.git Allow nothing to be selected from formspec parameters --- 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; }