diff options
author | Underground78 <underground78@users.sourceforge.net> | 2012-05-08 00:59:01 +0400 |
---|---|---|
committer | Underground78 <underground78@users.sourceforge.net> | 2012-05-08 00:59:01 +0400 |
commit | 685c28c60e40481b851e18ec495ecedb6a37791a (patch) | |
tree | 8376fc8440267221987b21953107c0a306de0142 /src/apps/mplayerc/PlayerNavigationDialog.cpp | |
parent | ed6a6799b8510385679b5a46a7b36fd352cb1530 (diff) |
Avoid possible NULL pointer dereferencing (/analyze warning C6011).
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@4633 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/apps/mplayerc/PlayerNavigationDialog.cpp')
-rw-r--r-- | src/apps/mplayerc/PlayerNavigationDialog.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/apps/mplayerc/PlayerNavigationDialog.cpp b/src/apps/mplayerc/PlayerNavigationDialog.cpp index 789b25741..bcb252aeb 100644 --- a/src/apps/mplayerc/PlayerNavigationDialog.cpp +++ b/src/apps/mplayerc/PlayerNavigationDialog.cpp @@ -114,33 +114,34 @@ void CPlayerNavigationDialog::OnChangeChannel() void CPlayerNavigationDialog::SetupAudioSwitcherSubMenu(CDVBChannel* pChannel)
{
- bool bFound = FALSE;
+ bool bFound = (pChannel != NULL);
int nCurrentChannel;
AppSettings& s = AfxGetAppSettings();
- if (!pChannel) {
+ if (!bFound) {
nCurrentChannel = s.nDVBLastChannel;
POSITION pos = s.m_DVBChannels.GetHeadPosition();
while (pos && !bFound) {
pChannel = &s.m_DVBChannels.GetNext(pos);
if (nCurrentChannel == pChannel->GetPrefNumber()) {
- bFound = TRUE;
- break;
+ bFound = true;
}
}
}
- m_ButtonInfo.EnableWindow(pChannel->GetNowNextFlag());
- m_ComboAudio.ResetContent();
- for (int i=0; i < pChannel->GetAudioCount(); i++) {
- m_ComboAudio.AddString(pChannel->GetAudio(i)->Language);
- m_audios[i].PID = pChannel->GetAudio(i)-> PID;
- m_audios[i].Type = pChannel->GetAudio(i)->Type;
- m_audios[i].PesType = pChannel->GetAudio(i) -> PesType;
- m_audios[i].Language = pChannel->GetAudio(i) -> Language;
- }
+ if (bFound) {
+ m_ButtonInfo.EnableWindow(pChannel->GetNowNextFlag());
+ m_ComboAudio.ResetContent();
+ for (int i=0; i < pChannel->GetAudioCount(); i++) {
+ m_ComboAudio.AddString(pChannel->GetAudio(i)->Language);
+ m_audios[i].PID = pChannel->GetAudio(i)-> PID;
+ m_audios[i].Type = pChannel->GetAudio(i)->Type;
+ m_audios[i].PesType = pChannel->GetAudio(i) -> PesType;
+ m_audios[i].Language = pChannel->GetAudio(i) -> Language;
+ }
- m_ComboAudio.SetCurSel(pChannel->GetDefaultAudio());
+ m_ComboAudio.SetCurSel(pChannel->GetDefaultAudio());
+ }
}
void CPlayerNavigationDialog::UpdateElementList()
|