CDPlayer doesn't crash anymore when the CDDB lookup fails

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13551 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm
2005-07-08 01:37:37 +00:00
parent 79482d6383
commit 66c912db47
3 changed files with 20 additions and 10 deletions
+2 -1
View File
@@ -10,7 +10,8 @@ enum CDState {
kStopped, kStopped,
kPaused, kPaused,
kPlaying, kPlaying,
kSkipping kSkipping,
kError
}; };
typedef struct typedef struct
+1 -1
View File
@@ -189,7 +189,7 @@ CDContentWatcher::GetContent(BString *title, vector<BString> *tracks)
bool bool
CDContentWatcher::UpdateState() CDContentWatcher::UpdateState()
{ {
bool newDiscID = -1; int32 newDiscID = -1;
// Check the table of contents to see if the new one is different // Check the table of contents to see if the new one is different
// from the old one whenever there is a CD in the drive // from the old one whenever there is a CD in the drive
+17 -8
View File
@@ -528,20 +528,29 @@ CDPlayer::UpdateCDInfo(void)
vector<BString> trackNames; vector<BString> trackNames;
int32 currentTrack = engine->TrackStateWatcher()->GetTrack(); int32 currentTrack = engine->TrackStateWatcher()->GetTrack();
engine->ContentWatcher()->GetContent(&CDName,&trackNames); if(currentTrack < 1)
return;
fCDTitle->SetText(CDName.String()); bool trackresult =engine->ContentWatcher()->GetContent(&CDName,&trackNames);
if(trackresult)
fCDTitle->SetText(CDName.String());
else
fCDTitle->SetText("Audio CD");
if(currentTrack > 0) if(currentTrack > 0)
{ {
currentTrackName << "Track " << currentTrack << ": " << trackNames[ currentTrack - 1]; if(trackresult)
{
currentTrackName << "Track " << currentTrack << ": " << trackNames[ currentTrack - 1];
fCurrentTrack->SetText(currentTrackName.String());
return;
}
currentTrackName << "Track " << currentTrack;
fCurrentTrack->SetText(currentTrackName.String()); fCurrentTrack->SetText(currentTrackName.String());
} }
else
{
fCurrentTrack->SetText("Track:");
}
} }
void void