Skip to content

Commit

Permalink
Re-organise some things to stop Coverity et al warning about possible…
Browse files Browse the repository at this point in the history
… null pointer dereferences in mythfrontend.
  • Loading branch information
stuartm committed May 24, 2012
1 parent 8497403 commit 502f0b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion mythtv/programs/mythfrontend/playbackbox.cpp
Expand Up @@ -981,7 +981,7 @@ void PlaybackBox::ItemVisible(MythUIButtonListItem *item)
item->DisplayState(extract_commflag_state(*pginfo), "commflagged");

MythUIButtonListItem *sel_item = item->parent()->GetItemCurrent();
if ((item != sel_item) && pginfo && item->GetImage("preview").isEmpty() &&
if ((item != sel_item) && item->GetImage("preview").isEmpty() &&
(asAvailable == pginfo->GetAvailableStatus()))
{
QString token = m_helper.GetPreviewImage(*pginfo, true);
Expand Down
12 changes: 7 additions & 5 deletions mythtv/programs/mythfrontend/videodlg.cpp
Expand Up @@ -109,15 +109,15 @@ namespace
if (item)
return item->GetData().value<MythGenericTree *>();

return 0;
return NULL;
}

VideoMetadata *GetMetadataPtrFromNode(MythGenericTree *node)
{
if (node)
return node->GetData().value<TreeNodeData>().GetMetadata();

return 0;
return NULL;
}

bool GetLocalVideoImage(const QString &video_uid, const QString &filename,
Expand Down Expand Up @@ -2345,7 +2345,7 @@ void VideoDialog::VideoMenu()

MythUIButtonListItem *item = GetItemCurrent();
MythGenericTree *node = GetNodePtrFromButton(item);
if (node && node->getInt() >= 0)
if (metadata)
{
if (!metadata->GetTrailer().isEmpty() ||
gCoreContext->GetNumSetting("mythvideo.TrailersRandomEnabled", 0) ||
Expand All @@ -2361,8 +2361,10 @@ void VideoDialog::VideoMenu()
menu->AddItem(tr("Change Video Details"), NULL, CreateManageMenu());
menu->AddItem(tr("Delete"), SLOT(RemoveVideo()));
}
if (node && !(node->getInt() >= 0) && node->getInt() != kUpFolder)
else if (node && node->getInt() != kUpFolder)
{
menu->AddItem(tr("Play Folder"), SLOT(playFolder()));
}


m_menuPopup = new MythDialogBox(menu, m_popupStack, "videomenupopup");
Expand Down Expand Up @@ -3182,7 +3184,7 @@ VideoMetadata *VideoDialog::GetMetadata(MythUIButtonListItem *item)
int nodeInt = node->getInt();

if (nodeInt >= 0)
metadata = GetMetadataPtrFromNode(node);
metadata = GetMetadataPtrFromNode(node);
}
}

Expand Down

0 comments on commit 502f0b0

Please sign in to comment.