Skip to content

Commit 1b15d47

Browse files
committed
Merged revision(s) 25360 from trunk/OpenMPT:
[Fix] General Tab: Possible crash when hovering disabled channel controls (with less than four channels active on the tab) ........ git-svn-id: https://source.openmpt.org/svn/openmpt/branches/OpenMPT-1.32@25361 56274372-70c3-4bfc-bfc3-4c3a0b034d27
1 parent 7b7e530 commit 1b15d47

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

mptrack/View_gen.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,25 +1805,29 @@ BOOL CViewGlobals::OnToolTipText(UINT, NMHDR *pNMHDR, LRESULT *pResult)
18051805
case IDC_EDIT3:
18061806
case IDC_EDIT5:
18071807
case IDC_EDIT7:
1808-
text = CModDoc::LinearToDecibelsString(chnSettings[m_nActiveTab * CHANNELS_IN_TAB + (id - IDC_EDIT1) / 2].nVolume, 64.0);
1808+
if(size_t chn = m_nActiveTab * CHANNELS_IN_TAB + (id - IDC_EDIT1) / 2; chn < chnSettings.size())
1809+
text = CModDoc::LinearToDecibelsString(chnSettings[chn].nVolume, 64.0);
18091810
break;
18101811
case IDC_SLIDER1:
18111812
case IDC_SLIDER3:
18121813
case IDC_SLIDER5:
18131814
case IDC_SLIDER7:
1814-
text = CModDoc::LinearToDecibelsString(chnSettings[m_nActiveTab * CHANNELS_IN_TAB + (id - IDC_SLIDER1) / 2].nVolume, 64.0);
1815+
if(size_t chn = m_nActiveTab * CHANNELS_IN_TAB + (id - IDC_SLIDER1) / 2; chn < chnSettings.size())
1816+
text = CModDoc::LinearToDecibelsString(chnSettings[chn].nVolume, 64.0);
18151817
break;
18161818
case IDC_EDIT2:
18171819
case IDC_EDIT4:
18181820
case IDC_EDIT6:
18191821
case IDC_EDIT8:
1820-
text = CModDoc::PanningToString(chnSettings[m_nActiveTab * CHANNELS_IN_TAB + (id - IDC_EDIT2) / 2].nPan, 128);
1822+
if(size_t chn = m_nActiveTab * CHANNELS_IN_TAB + (id - IDC_EDIT2) / 2; chn < chnSettings.size())
1823+
text = CModDoc::PanningToString(chnSettings[chn].nPan, 128);
18211824
break;
18221825
case IDC_SLIDER2:
18231826
case IDC_SLIDER4:
18241827
case IDC_SLIDER6:
18251828
case IDC_SLIDER8:
1826-
text = CModDoc::PanningToString(chnSettings[m_nActiveTab * CHANNELS_IN_TAB + (id - IDC_SLIDER2) / 2].nPan, 128);
1829+
if(size_t chn = m_nActiveTab * CHANNELS_IN_TAB + (id - IDC_SLIDER2) / 2; chn < chnSettings.size())
1830+
text = CModDoc::PanningToString(chnSettings[chn].nPan, 128);
18271831
break;
18281832
case IDC_EDIT16:
18291833
{

0 commit comments

Comments
 (0)