Permalink
Browse files

Guard against a null pointer in ToggleWatched(), unlikely but best no…

…t to assume it's impossible.
  • Loading branch information...
stuartm committed May 3, 2012
1 parent 7fd0a8c commit a08bfed70d5d8eb72142078a9e383da7001eeef4
Showing with 6 additions and 2 deletions.
  1. +6 −2 mythtv/programs/mythfrontend/videodlg.cpp
@@ -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");
}
}

0 comments on commit a08bfed

Please sign in to comment.