Fix potential pre-gap bug in cue sheet

If an index #0 is present for a track but not for the next track, it
could be written for the following track (i.e. two tracks from where it
appeared), which would lead to an incoherent cue sheet.

In theory, this was a non-issue because in NRG, a track always has an
index #0, but you never know.
Matteo Cypriani 6 years ago
parent 54b5967411
commit 15c5a5fb04

@ -85,9 +85,12 @@ fn write_cue_track(fd: &mut File, track: &NrgCuexTrack, index0_pos: &mut i32)
// position (i.e., it indicates a pre-gap)
if *index0_pos >= 0 && *index0_pos < track.position_sectors {
try!(write_cue_index(fd, 0, *index0_pos));
*index0_pos = -1;
// Reset index0 (even if we didn't write it, because it only applies to the
// current track)
*index0_pos = -1;
// Write current index
write_cue_index(fd, track.index_number, track.position_sectors)