Skip to content

Commit

Permalink
Guard against a null pointer in ToggleWatched(), unlikely but best no…
Browse files Browse the repository at this point in the history
…t to assume it's impossible.
  • Loading branch information
stuartm committed May 3, 2012
1 parent 7fd0a8c commit a08bfed
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mythtv/programs/mythfrontend/videodlg.cpp
Expand Up @@ -3397,12 +3397,16 @@ void VideoDialog::VideoAutoSearch(MythGenericTree *node)

void VideoDialog::ToggleWatched()
{
VideoMetadata *metadata = GetMetadata(GetItemCurrent());
MythUIButtonListItem *item = GetItemCurrent();
if (!item)
return;

VideoMetadata *metadata = GetMetadata(item);
if (metadata)
{
metadata->SetWatched(!metadata->GetWatched());
metadata->UpdateDatabase();
GetItemCurrent()->DisplayState(WatchedToState(metadata->GetWatched()),
item->DisplayState(WatchedToState(metadata->GetWatched()),
"watchedstate");
}
}
Expand Down

0 comments on commit a08bfed

Please sign in to comment.