Skip to content

Commit

Permalink
GUI: Don't deref sound items before nullptr checking
Browse files Browse the repository at this point in the history
This fixes Coverity Scan issue #218995.
  • Loading branch information
DrMcCoy committed Jul 27, 2019
1 parent 871142b commit f07d2ab
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/gui/panelpreviewsound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,13 @@ void PanelPreviewSound::show(const ResourceTreeItem *item) {
PanelBase::show(item);

stop();
_currentItem = nullptr;
_duration = Sound::RewindableAudioStream::kInvalidLength;

if (item->getResourceType() != Aurora::kResourceSound)
if (!item || (item->getResourceType() != Aurora::kResourceSound))
return;

_currentItem = item;

if (!item) {
_duration = Sound::RewindableAudioStream::kInvalidLength;
return;
}

_duration = item->getSoundDuration();
}

Expand Down

0 comments on commit f07d2ab

Please sign in to comment.