diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index fb88687e3..1fc30cbc7 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -4166,15 +4166,18 @@ void CEditor::RenderSounds(CUIRect ToolBox) ToolBox.y += ScrollOffset.y; bool ScrollToSelection = false; - if(Input()->KeyPress(KEY_DOWN) && m_Dialog == DIALOG_NONE) + if(m_Dialog == DIALOG_NONE && !m_Map.m_vpSounds.empty()) { - m_SelectedSound = (m_SelectedSound + 1) % m_Map.m_vpSounds.size(); - ScrollToSelection = true; - } - if(Input()->KeyPress(KEY_UP) && m_Dialog == DIALOG_NONE) - { - m_SelectedSound = (m_SelectedSound + m_Map.m_vpSounds.size() - 1) % m_Map.m_vpSounds.size(); - ScrollToSelection = true; + if(Input()->KeyPress(KEY_DOWN)) + { + m_SelectedSound = (m_SelectedSound + 1) % m_Map.m_vpSounds.size(); + ScrollToSelection = true; + } + else if(Input()->KeyPress(KEY_UP)) + { + m_SelectedSound = (m_SelectedSound + m_Map.m_vpSounds.size() - 1) % m_Map.m_vpSounds.size(); + ScrollToSelection = true; + } } CUIRect Slot;