2015-03-10 Fred Gleason <fredg@paravelsystems.com>

* Fixed a bug in 'lib/rdcdplayer.cpp' that threw a segfault
	when opening the ripper with no CD inserted under RHEL 7.
This commit is contained in:
Fred Gleason 2015-03-10 16:08:04 -04:00
parent da8cf74df8
commit 5e20febe5b
2 changed files with 13 additions and 7 deletions

View File

@ -14834,3 +14834,6 @@
* Added a 'Capability::HaveMp4Decode' value to the * Added a 'Capability::HaveMp4Decode' value to the
'RDStation::Capability' enumeration in 'lib/rdstation.cpp' and 'RDStation::Capability' enumeration in 'lib/rdstation.cpp' and
'lib/rdstation.h'. 'lib/rdstation.h'.
2015-03-10 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in 'lib/rdcdplayer.cpp' that threw a segfault
when opening the ripper with no CD inserted under RHEL 7.

View File

@ -201,13 +201,15 @@ int RDCdPlayer::rightVolume()
void RDCdPlayer::setCddbRecord(RDCddbRecord *rec) void RDCdPlayer::setCddbRecord(RDCddbRecord *rec)
{ {
rec->setTracks(cdrom_track_count); if(cdrom_track_count>0) {
rec->setDiscId(cdrom_disc_id); rec->setTracks(cdrom_track_count);
rec->setDiscLength(75*(60*cdrom_track_start[cdrom_track_count].msf.minute+ rec->setDiscId(cdrom_disc_id);
cdrom_track_start[cdrom_track_count].msf.second)+ rec->setDiscLength(75*(60*cdrom_track_start[cdrom_track_count].msf.minute+
cdrom_track_start[cdrom_track_count].msf.frame); cdrom_track_start[cdrom_track_count].msf.second)+
for(int i=0;i<cdrom_track_count;i++) { cdrom_track_start[cdrom_track_count].msf.frame);
rec->setTrackOffset(i,trackOffset(i)); for(int i=0;i<cdrom_track_count;i++) {
rec->setTrackOffset(i,trackOffset(i));
}
} }
} }
@ -460,6 +462,7 @@ void RDCdPlayer::ReadToc()
// //
if(ioctl(cdrom_fd,CDROMREADTOCHDR,&tochdr)<0) { if(ioctl(cdrom_fd,CDROMREADTOCHDR,&tochdr)<0) {
cdrom_track_count=0; cdrom_track_count=0;
return;
} }
cdrom_track_count=tochdr.cdth_trk1-tochdr.cdth_trk0+1; cdrom_track_count=tochdr.cdth_trk1-tochdr.cdth_trk0+1;