UsbGadgetHal: Add null check in getCurrentUsbFunctions()
Avoid dereferencing if the callback parameter is null.
Change-Id: I9da79fd92f44abf0175e2ca311f0247b49bace1d
diff --git a/hal/UsbGadget.cpp b/hal/UsbGadget.cpp
index 65a8c09..10173e0 100644
--- a/hal/UsbGadget.cpp
+++ b/hal/UsbGadget.cpp
@@ -107,6 +107,8 @@
Return<void> UsbGadget::getCurrentUsbFunctions(
const sp<V1_0::IUsbGadgetCallback> &callback) {
+ if (!callback) return Void();
+
Return<void> ret = callback->getCurrentUsbFunctionsCb(
mCurrentUsbFunctions, mCurrentUsbFunctionsApplied
? Status::FUNCTIONS_APPLIED