diff --git a/audiohandler.cpp b/audiohandler.cpp index 9fd5c4b..fd702e2 100644 --- a/audiohandler.cpp +++ b/audiohandler.cpp @@ -24,12 +24,17 @@ audioHandler::~audioHandler() if (resampler != Q_NULLPTR) { speex_resampler_destroy(resampler); } + if (audio->isStreamRunning()) { audio->stopStream(); audio->closeStream(); } - delete audio; + + if (audio != Q_NULLPTR) { + delete audio; + } + if (ringBuf != Q_NULLPTR) delete ringBuf; }