Skip to content

Commit

Permalink
Fix null pointer check _after_ dereference in SetPreviewGenerator(). …
Browse files Browse the repository at this point in the history
…Coverity 700692
  • Loading branch information
stuartm committed Dec 18, 2012
1 parent b7b6e62 commit 46f0b4f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mythtv/libs/libmythtv/previewgeneratorqueue.cpp
Expand Up @@ -470,6 +470,9 @@ void PreviewGeneratorQueue::UpdatePreviewGeneratorThreads(void)
void PreviewGeneratorQueue::SetPreviewGenerator(
const QString &key, PreviewGenerator *g)
{
if (!g)
return;

{
QMutexLocker locker(&m_lock);
m_tokenToKeyMap[g->GetToken()] = key;
Expand All @@ -481,9 +484,10 @@ void PreviewGeneratorQueue::SetPreviewGenerator(
if (!g->GetToken().isEmpty())
state.tokens.insert(g->GetToken());
g->deleteLater();
g = NULL;
}
}
else if (g)
else
{
g->AttachSignals(this);
state.gen = g;
Expand Down

0 comments on commit 46f0b4f

Please sign in to comment.