Skip to content

Commit

Permalink
MythMusic: fix Coverity ID 1026166 Improper use of negative value
Browse files Browse the repository at this point in the history
In Ripper::toggleTrackActive(MythUIButtonListItem *): Negative value can be
returned from function is not being checked before being used improperly

The only way this could be a problem is if item doesn't exist which is very
unlikely.
  • Loading branch information
Paul Harrison committed May 31, 2013
1 parent 27b78ab commit 024a44f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mythplugins/mythmusic/mythmusic/cdrip.cpp
Expand Up @@ -1294,7 +1294,13 @@ void Ripper::toggleTrackActive(MythUIButtonListItem *item)
if (m_tracks->isEmpty() || !item)
return;

RipTrack *track = m_tracks->at(m_trackList->GetItemPos(item));
int pos = m_trackList->GetItemPos(item);

// sanity check item position
if (pos < 0 || pos > m_tracks->count() - 1)
return;

RipTrack *track = m_tracks->at(pos);

if (!track->active && !track->isNew)
{
Expand Down

0 comments on commit 024a44f

Please sign in to comment.