mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Fix crash in editor when using up/down keys on empty sounds list
This commit is contained in:
parent
8feba4ecf6
commit
4a683e024a
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue