From: robiwan Date: Tue, 19 Jun 2012 20:08:03 +0000 (+0000) Subject: Forgot error check after Pa_OpenStream. Naughty. X-Git-Tag: pa_stable_v19_20140130_r1919~63 X-Git-Url: https://andrewgundersen.net/repos?a=commitdiff_plain;h=3e9e7dd334304dae243707e524f3364b874f2dd5;p=portaudio Forgot error check after Pa_OpenStream. Naughty. --- diff --git a/examples/paex_sine_c++.cpp b/examples/paex_sine_c++.cpp index cc436b3..5b96aee 100644 --- a/examples/paex_sine_c++.cpp +++ b/examples/paex_sine_c++.cpp @@ -94,6 +94,12 @@ public: this /* Using 'this' for userData so we can cast to Sine* in paCallback method */ ); + if (err != paNoError) + { + /* Failed to open stream to device !!! */ + return false; + } + err = Pa_SetStreamFinishedCallback( stream, &Sine::paStreamFinished ); if (err != paNoError) @@ -121,6 +127,9 @@ public: bool start() { + if (stream == 0) + return false; + PaError err = Pa_StartStream( stream ); return (err == paNoError); @@ -128,6 +137,9 @@ public: bool stop() { + if (stream == 0) + return false; + PaError err = Pa_StopStream( stream ); return (err == paNoError);