audiohal: Fix handling of invalid arguments in 'debugDump' methods

Add checks for validity of the passed in native handle.

Bug: 37590777
Change-Id: If906f0086c3442819e1844cc521215d5b74af015
Test: VTS
diff --git a/audio/2.0/default/Device.cpp b/audio/2.0/default/Device.cpp
index 9a4aff6..b696d94 100644
--- a/audio/2.0/default/Device.cpp
+++ b/audio/2.0/default/Device.cpp
@@ -292,7 +292,7 @@
 }
 
 Return<void> Device::debugDump(const hidl_handle& fd)  {
-    if (fd->numFds == 1) {
+    if (fd.getNativeHandle() != nullptr && fd->numFds == 1) {
         analyzeStatus("dump", mDevice->dump(mDevice, fd->data[0]));
     }
     return Void();
diff --git a/audio/2.0/default/Stream.cpp b/audio/2.0/default/Stream.cpp
index 29946fe..671f171 100644
--- a/audio/2.0/default/Stream.cpp
+++ b/audio/2.0/default/Stream.cpp
@@ -226,7 +226,7 @@
 }
 
 Return<void> Stream::debugDump(const hidl_handle& fd)  {
-    if (fd->numFds == 1) {
+    if (fd.getNativeHandle() != nullptr && fd->numFds == 1) {
         analyzeStatus("dump", mStream->dump(mStream, fd->data[0]));
     }
     return Void();