From 2cd1ecf22d26bfad6c01f63e8819d3f931b490aa Mon Sep 17 00:00:00 2001 From: DarkWyrm Date: Thu, 11 Aug 2005 20:24:55 +0000 Subject: [PATCH] Added some handler code for when no CD drive can be found git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13935 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/cdplayer/CDAudioDevice.cpp | 3 ++- src/apps/cdplayer/CDPlayer.cpp | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/apps/cdplayer/CDAudioDevice.cpp b/src/apps/cdplayer/CDAudioDevice.cpp index 9aea159e44..69f3a7da1b 100644 --- a/src/apps/cdplayer/CDAudioDevice.cpp +++ b/src/apps/cdplayer/CDAudioDevice.cpp @@ -16,7 +16,8 @@ CDAudioDevice::CDAudioDevice(void) { FindDrives("/dev/disk"); - SetDrive(0); + if(CountDrives()>0) + SetDrive(0); } CDAudioDevice::~CDAudioDevice(void) diff --git a/src/apps/cdplayer/CDPlayer.cpp b/src/apps/cdplayer/CDPlayer.cpp index b83b60764c..53033e5921 100644 --- a/src/apps/cdplayer/CDPlayer.cpp +++ b/src/apps/cdplayer/CDPlayer.cpp @@ -56,6 +56,16 @@ CDPlayer::CDPlayer(BRect frame, const char *name, uint32 resizeMask, uint32 flag engine = new CDEngine; BuildGUI(); + + CDAudioDevice cd; + if(cd.CountDrives()<1) + { + BAlert *alert = new BAlert("CDPlayer","It appears that there are no CD drives on your" + "computer or there is no system software to support one." + " Sorry.","OK"); + alert->Go(); + be_app->PostMessage(B_QUIT_REQUESTED); + } } CDPlayer::~CDPlayer()