From 3e9e7dd334304dae243707e524f3364b874f2dd5 Mon Sep 17 00:00:00 2001 From: robiwan Date: Tue, 19 Jun 2012 20:08:03 +0000 Subject: [PATCH] Forgot error check after Pa_OpenStream. Naughty. --- examples/paex_sine_c++.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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); -- 2.43.0