Fix crash in audiosystem_tests

Add nullptr check to AudioSystemTest::TearDown to handle
cases when initialization did not complete successfully.

Bug: 205884982
Test: atest audiosystem_tests
Change-Id: Id1e8ca4b9312af621ab200bd8217da6159d1cfc9
diff --git a/media/libaudioclient/tests/audiosystem_tests.cpp b/media/libaudioclient/tests/audiosystem_tests.cpp
index aed847c..ede62cc 100644
--- a/media/libaudioclient/tests/audiosystem_tests.cpp
+++ b/media/libaudioclient/tests/audiosystem_tests.cpp
@@ -49,12 +49,18 @@
     void TearDown() override {
         if (mPlayback) {
             mPlayback->stop();
-            mPlayback->getAudioTrackHandle()->removeAudioDeviceCallback(mCbPlayback);
+            if (auto handle = mPlayback->getAudioTrackHandle(); handle) {
+                handle->removeAudioDeviceCallback(mCbPlayback);
+            }
+            mCbPlayback.clear();
             mPlayback.clear();
         }
         if (mCapture) {
             mCapture->stop();
-            mCapture->getAudioRecordHandle()->removeAudioDeviceCallback(mCbRecord);
+            if (auto handle = mCapture->getAudioRecordHandle(); handle) {
+                handle->removeAudioDeviceCallback(mCbRecord);
+            }
+            mCbRecord.clear();
             mCapture.clear();
         }
     }