Fix a memleak pointed by @Zeno- in MeshUpdateQueue
[oweals/minetest.git] / src / guiTable.cpp
index 3cc95ce4fcde25bc9fba53900f7680775e2569b5..d223e3069b0409f387af40a0e202e65b3669f6f7 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;
        }
@@ -830,7 +828,7 @@ bool GUITable::OnEvent(const SEvent &event)
                }
                else if (event.KeyInput.PressedDown && event.KeyInput.Char) {
                        // change selection based on text as it is typed
-                       s32 now = getTimeMs();
+                       u64 now = porting::getTimeMs();
                        if (now - m_keynav_time >= 500)
                                m_keynav_buffer = L"";
                        m_keynav_time = now;