mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Allow nothing to be selected from formspec parameters
This commit is contained in:
parent
3a95054db5
commit
eb0e9d5661
1 changed files with 1 additions and 3 deletions
|
@ -565,10 +565,8 @@ void GUITable::setSelected(s32 index)
|
||||||
--index; // Switch from 1-based indexing to 0-based indexing
|
--index; // Switch from 1-based indexing to 0-based indexing
|
||||||
|
|
||||||
s32 rowcount = m_rows.size();
|
s32 rowcount = m_rows.size();
|
||||||
if (rowcount == 0) {
|
if (rowcount == 0 || index < 0) {
|
||||||
return;
|
return;
|
||||||
} else if (index < 0) {
|
|
||||||
index = 0;
|
|
||||||
} else if (index >= rowcount) {
|
} else if (index >= rowcount) {
|
||||||
index = rowcount - 1;
|
index = rowcount - 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue