avoid null pointer use

Origin commit data
------------------
Branch: ni/coolstream
Commit: 8fb4e1b78e
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2016-04-21 (Thu, 21 Apr 2016)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2016-04-21 15:29:18 +02:00
parent d44c7b1a9d
commit bc92bf0e62
6 changed files with 16 additions and 12 deletions

View File

@@ -86,7 +86,8 @@ void CAdZapMenu::Init()
{ {
CChannelList *channelList = CNeutrinoApp::getInstance()->channelList; CChannelList *channelList = CNeutrinoApp::getInstance()->channelList;
channelId = channelList ? channelList->getActiveChannel_ChannelID() : -1; channelId = channelList ? channelList->getActiveChannel_ChannelID() : -1;
channelName = channelList->getActiveChannelName(); if(channelList)
channelName = channelList->getActiveChannelName();
evtlist.clear(); evtlist.clear();
CEitManager::getInstance()->getEventsServiceKey(channelId & 0xFFFFFFFFFFFFULL, evtlist); CEitManager::getInstance()->getEventsServiceKey(channelId & 0xFFFFFFFFFFFFULL, evtlist);
monitorLifeTime.tv_sec = 0; monitorLifeTime.tv_sec = 0;

View File

@@ -104,7 +104,7 @@ int CCAMMenuHandler::doMainMenu()
char name1[255]={0}; char name1[255]={0};
char str1[255]={0}; char str1[255]={0};
int CiSlots = ca->GetNumberCISlots(); int CiSlots = ca ? ca->GetNumberCISlots() : 0;
CMenuWidget* cammenu = new CMenuWidget(LOCALE_CI_SETTINGS, NEUTRINO_ICON_SETTINGS); CMenuWidget* cammenu = new CMenuWidget(LOCALE_CI_SETTINGS, NEUTRINO_ICON_SETTINGS);
cammenu->addIntroItems(); cammenu->addIntroItems();
@@ -171,7 +171,7 @@ int CCAMMenuHandler::doMainMenu()
} }
i = 0; i = 0;
int ScNum = ca->GetNumberSmartCardSlots(); int ScNum = ca ? ca->GetNumberSmartCardSlots() : 0;
printf("CCAMMenuHandler::doMainMenu sc slots: %d\n", ScNum); printf("CCAMMenuHandler::doMainMenu sc slots: %d\n", ScNum);
if(ScNum && CiSlots) if(ScNum && CiSlots)

View File

@@ -248,10 +248,10 @@ int CLuaInstCCWindow::CCWindowPaintHeader(lua_State *L)
if (!D) return 0; if (!D) return 0;
CComponentsHeader* header = D->w->getHeaderObject(); CComponentsHeader* header = D->w->getHeaderObject();
if (header) if (header){
D->w->showHeader(); D->w->showHeader();
header->paint(); header->paint();
}
return 0; return 0;
} }

View File

@@ -1055,7 +1055,8 @@ void CMoviePlayerGui::stopPlayBack(void)
printf("%s: this %p join background thread %lx\n", __func__, this, bgThread);fflush(stdout); printf("%s: this %p join background thread %lx\n", __func__, this, bgThread);fflush(stdout);
mutex.lock(); mutex.lock();
webtv_started = false; webtv_started = false;
playback->RequestAbort(); if(playback)
playback->RequestAbort();
mutex.unlock(); mutex.unlock();
cond.broadcast(); cond.broadcast();
pthread_join(bgThread, NULL); pthread_join(bgThread, NULL);
@@ -1832,7 +1833,7 @@ void CMoviePlayerGui::selectAudioPid()
APIDSelector.addItem(item, defpid); APIDSelector.addItem(item, defpid);
} }
int percent[numpida]; int percent[numpida+1];
if (p_movie_info && numpida <= p_movie_info->audioPids.size()) { if (p_movie_info && numpida <= p_movie_info->audioPids.size()) {
APIDSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_AUDIOMENU_VOLUME_ADJUST)); APIDSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_AUDIOMENU_VOLUME_ADJUST));
@@ -2061,7 +2062,8 @@ void CMoviePlayerGui::handleMovieBrowser(neutrino_msg_t msg, int /*position*/)
#endif #endif
const char *unit_short_minute = g_Locale->getText(LOCALE_UNIT_SHORT_MINUTE); const char *unit_short_minute = g_Locale->getText(LOCALE_UNIT_SHORT_MINUTE);
char play_pos[32]; char play_pos[32];
snprintf(play_pos, sizeof(play_pos), "%3d %s", p_movie_info->bookmarks.lastPlayStop/60, unit_short_minute); int lastplaystop = p_movie_info ? p_movie_info->bookmarks.lastPlayStop/60:0;
snprintf(play_pos, sizeof(play_pos), "%3d %s", lastplaystop, unit_short_minute);
char start_pos[32] = {0}; char start_pos[32] = {0};
if (p_movie_info->bookmarks.start != 0) if (p_movie_info->bookmarks.start != 0)
snprintf(start_pos, sizeof(start_pos), "%3d %s", p_movie_info->bookmarks.start/60, unit_short_minute); snprintf(start_pos, sizeof(start_pos), "%3d %s", p_movie_info->bookmarks.start/60, unit_short_minute);

View File

@@ -72,7 +72,6 @@ int CPictureViewerSetup::exec(CMenuTarget* parent, const std::string &actionKey)
if(actionKey == "picturedir") if(actionKey == "picturedir")
{ {
parent->hide();
CFileBrowser b; CFileBrowser b;
b.Dir_Mode=true; b.Dir_Mode=true;
if (b.exec(g_settings.network_nfs_picturedir.c_str())) if (b.exec(g_settings.network_nfs_picturedir.c_str()))

View File

@@ -382,7 +382,8 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey)
return menu_return::RETURN_EXIT; return menu_return::RETURN_EXIT;
} }
else if(actionKey == "rec_dir1") { else if(actionKey == "rec_dir1") {
parent->hide(); if (parent)
parent->hide();
const char *action_str = "RecDir1"; const char *action_str = "RecDir1";
if(chooserDir(timerlist[selected].recordingDir, true, action_str, sizeof(timerlist[selected].recordingDir)-1)) { if(chooserDir(timerlist[selected].recordingDir, true, action_str, sizeof(timerlist[selected].recordingDir)-1)) {
printf("[timerlist] new %s dir %s\n", action_str, timerlist[selected].recordingDir); printf("[timerlist] new %s dir %s\n", action_str, timerlist[selected].recordingDir);
@@ -391,7 +392,8 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey)
return menu_return::RETURN_REPAINT; return menu_return::RETURN_REPAINT;
} }
else if(actionKey == "rec_dir2") { else if(actionKey == "rec_dir2") {
parent->hide(); if (parent)
parent->hide();
const char *action_str = "RecDir2"; const char *action_str = "RecDir2";
if(chooserDir(timerNew.recordingDir, true, action_str, sizeof(timerNew.recordingDir)-1)) { if(chooserDir(timerNew.recordingDir, true, action_str, sizeof(timerNew.recordingDir)-1)) {
printf("[timerlist] new %s dir %s\n", action_str, timerNew.recordingDir); printf("[timerlist] new %s dir %s\n", action_str, timerNew.recordingDir);