Skip to content

Commit 9d98a08

Browse files
author
Manuel Roman
committed
Check result handler is not null
If caller passes a null result handler to the proxy methods, we need to check it when getting the result. Otherwise we try to invoke a method on a null object Change-Id: Ic2f456c36cb542b782b6a6d0d4d607ccf0987496
1 parent 993f8a8 commit 9d98a08

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tools/aidl/generate_java_rpc.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,10 @@ generate_result_dispatcher_method(const method_type* method,
784784
}
785785

786786
// Call the callback method
787-
dispatchMethod->statements->Add(realCall);
787+
IfStatement* ifst = new IfStatement;
788+
ifst->expression = new Comparison(new FieldVariable(THIS_VALUE, "callback"), "!=", NULL_VALUE);
789+
dispatchMethod->statements->Add(ifst);
790+
ifst->statements->Add(realCall);
788791
}
789792

790793
static void

0 commit comments

Comments
 (0)