]> git.tdb.fi Git - r2c2.git/commitdiff
Fix a problem with TrackIter::block_iter at end of line
authorMikko Rasa <tdb@tdb.fi>
Mon, 3 Jun 2013 18:39:25 +0000 (21:39 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 3 Jun 2013 19:17:56 +0000 (22:17 +0300)
If the track iterator was already on the last track, the check for
returning an empty block iterator would not get executed, and the throw
at the end of the function would get triggered.

source/libr2c2/trackiter.cpp

index 31ebf08e1f1c59711208c0f51722480cbc529c46..e07c71c02bac8faa42f7ec067eb184c3f7847e97 100644 (file)
@@ -43,12 +43,12 @@ BlockIter TrackIter::block_iter() const
                {
                        last = rev;
                        rev = rev.next();
-
-                       // If we ran out of tracks, return an empty iterator
-                       if(!rev)
-                               return BlockIter();
                }
 
+               // If we ran out of tracks, return an empty iterator
+               if(!rev)
+                       return BlockIter();
+
                TrackIter fwd = last.reverse();
                for(unsigned i=0; i<beps.size(); ++i)
                        if(beps[i].track==fwd.track() && beps[i].track_ep==fwd.entry())