mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 06:28:19 +00:00
Fix editor crash with sound preview when sound is not valid
This happens if a sound could not be loaded successfully.
This commit is contained in:
parent
690912e209
commit
3b0d9cd6c9
|
@ -1379,12 +1379,17 @@ void CEditor::DoToolbarSounds(CUIRect ToolBar)
|
||||||
if(pSelectedSound->m_SoundId != m_ToolbarPreviewSound && m_ToolbarPreviewSound >= 0 && Sound()->IsPlaying(m_ToolbarPreviewSound))
|
if(pSelectedSound->m_SoundId != m_ToolbarPreviewSound && m_ToolbarPreviewSound >= 0 && Sound()->IsPlaying(m_ToolbarPreviewSound))
|
||||||
Sound()->Stop(m_ToolbarPreviewSound);
|
Sound()->Stop(m_ToolbarPreviewSound);
|
||||||
m_ToolbarPreviewSound = pSelectedSound->m_SoundId;
|
m_ToolbarPreviewSound = pSelectedSound->m_SoundId;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_ToolbarPreviewSound = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_ToolbarPreviewSound >= 0)
|
||||||
|
{
|
||||||
static int s_PlayPauseButton, s_StopButton, s_SeekBar = 0;
|
static int s_PlayPauseButton, s_StopButton, s_SeekBar = 0;
|
||||||
DoAudioPreview(ToolBarBottom, &s_PlayPauseButton, &s_StopButton, &s_SeekBar, m_ToolbarPreviewSound);
|
DoAudioPreview(ToolBarBottom, &s_PlayPauseButton, &s_StopButton, &s_SeekBar, m_ToolbarPreviewSound);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
m_ToolbarPreviewSound = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Rotate(const CPoint *pCenter, CPoint *pPoint, float Rotation)
|
static void Rotate(const CPoint *pCenter, CPoint *pPoint, float Rotation)
|
||||||
|
|
Loading…
Reference in a new issue