]> git.sesse.net Git - nageru/commitdiff
Fix a crash if exiting while we are still trying to re-find an ALSA card from a loade...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 9 Nov 2017 20:01:13 +0000 (21:01 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 9 Nov 2017 20:01:13 +0000 (21:01 +0100)
alsa_input.cpp

index b5fe3cb904675a2596e4e87cf5dcd86387c62062..7230abeecd10839c8bcbb84c87a40d9c18115747 100644 (file)
@@ -184,7 +184,9 @@ void ALSAInput::capture_thread_func()
 
        if (should_quit.should_quit()) {
                // Don't call free_card(); that would be a deadlock.
-               WARN_ON_ERROR("snd_pcm_close()", snd_pcm_close(pcm_handle));
+               if (pcm_handle) {
+                       WARN_ON_ERROR("snd_pcm_close()", snd_pcm_close(pcm_handle));
+               }
                pcm_handle = nullptr;
                return;
        }