Index: src/common/pa_front.c
===================================================================
RCS file: /u/formes/share/cvsroot/portaudiov19c2/src/common/pa_front.c,v
retrieving revision 1.1
retrieving revision 1.3
diff -B -b -w -U3 -r1.1 -r1.3
--- src/common/pa_front.c	23 Oct 2006 23:13:52 -0000	1.1
+++ src/common/pa_front.c	25 Oct 2006 17:46:16 -0000	1.3
@@ -242,7 +242,7 @@
             assert( hostApi->info.defaultInputDevice < hostApi->info.deviceCount );
             assert( hostApi->info.defaultOutputDevice < hostApi->info.deviceCount );
 
-            hostApis_[hostApisCount_]->privatePaFrontInfo.baseDeviceIndex = baseDeviceIndex;
+            hostApi->privatePaFrontInfo.baseDeviceIndex = baseDeviceIndex;
 
             if( hostApis_[hostApisCount_]->info.defaultInputDevice != paNoDevice )
                 hostApis_[hostApisCount_]->info.defaultInputDevice += baseDeviceIndex;
@@ -1094,7 +1094,7 @@
                               double sampleRate )
 {
     PaError result;
-    PaUtilHostApiRepresentation *hostApi;
+    PaUtilHostApiRepresentation *hostApi=0;
     PaDeviceIndex hostApiInputDevice, hostApiOutputDevice;
     PaStreamParameters hostApiInputParameters, hostApiOutputParameters;
     PaStreamParameters *hostApiInputParametersPtr, *hostApiOutputParametersPtr;
@@ -1209,7 +1209,7 @@
                        void *userData )
 {
     PaError result;
-    PaUtilHostApiRepresentation *hostApi;
+    PaUtilHostApiRepresentation *hostApi=0;
     PaDeviceIndex hostApiInputDevice, hostApiOutputDevice;
     PaStreamParameters hostApiInputParameters, hostApiOutputParameters;
     PaStreamParameters *hostApiInputParametersPtr, *hostApiOutputParametersPtr;
@@ -1370,6 +1370,9 @@
     if( inputChannelCount > 0 )
     {
         hostApiInputParameters.device = Pa_GetDefaultInputDevice();
+        if(hostApiInputParameters.device == paNoDevice) {
+          return paDeviceUnavailable;
+        }
         hostApiInputParameters.channelCount = inputChannelCount;
         hostApiInputParameters.sampleFormat = sampleFormat;
         /* defaultHighInputLatency is used below instead of
@@ -1390,6 +1393,9 @@
     if( outputChannelCount > 0 )
     {
         hostApiOutputParameters.device = Pa_GetDefaultOutputDevice();
+        if(hostApiOutputParameters.device == paNoDevice) {
+          return paDeviceUnavailable;
+        }
         hostApiOutputParameters.channelCount = outputChannelCount;
         hostApiOutputParameters.sampleFormat = sampleFormat;
         /* defaultHighOutputLatency is used below instead of
