Fixing null deference in android.hardware.usb.gadget-service.example

Test: atest VtsAidlUsbTargetTest
Bug: 267534245
Change-Id: Ib28b7848205809912b6789d0e050c1a981dc1ce8
This commit is contained in:
Pawan Wagh
2023-02-01 23:38:37 +00:00
parent 654e766039
commit 6fb5cb3332

View File

@@ -90,8 +90,11 @@ void currentFunctionsAppliedCallback(bool functionsApplied, void *payload) {
gadget->mCurrentUsbFunctionsApplied = functionsApplied;
}
ScopedAStatus UsbGadget::getCurrentUsbFunctions(const shared_ptr<IUsbGadgetCallback> &callback,
int64_t in_transactionId) {
ScopedAStatus UsbGadget::getCurrentUsbFunctions(const shared_ptr<IUsbGadgetCallback>& callback,
int64_t in_transactionId) {
if (callback == nullptr) {
return ScopedAStatus::fromExceptionCode(EX_NULL_POINTER);
}
ScopedAStatus ret = callback->getCurrentUsbFunctionsCb(
mCurrentUsbFunctions,
mCurrentUsbFunctionsApplied ? Status::FUNCTIONS_APPLIED : Status::FUNCTIONS_NOT_APPLIED,