summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorEugene Susla <eugenesusla@google.com>2017-07-07 14:06:14 -0700
committerEugene Susla <eugenesusla@google.com>2017-07-10 22:17:49 +0000
commit3a74c7ac8ebcdbca3f5dfcea3ac97e0d4cbab99c (patch)
treeeae3590e071a22584df26823ed631e197da20bf8 /core/java
parent150fec445a4f7db666a899de73f739d90397748a (diff)
[Companion] Prevent NPE in CallbackProxy
Fixes: 63383044 Test: Ensure all fields of CompanionDeviceManager.CallbackProxy are null-checked in onSuccess and onFailure Change-Id: If95a46686f74d184bccfcb2d8c8195add4747a07
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/companion/CompanionDeviceManager.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/core/java/android/companion/CompanionDeviceManager.java b/core/java/android/companion/CompanionDeviceManager.java
index 86a30cf0c846..076deab5d211 100644
--- a/core/java/android/companion/CompanionDeviceManager.java
+++ b/core/java/android/companion/CompanionDeviceManager.java
@@ -280,12 +280,24 @@ public final class CompanionDeviceManager {
@Override
public void onSuccess(PendingIntent launcher) {
- mHandler.post(() -> mCallback.onDeviceFound(launcher.getIntentSender()));
+ Handler handler = mHandler;
+ if (handler == null) return;
+ handler.post(() -> {
+ Callback callback = mCallback;
+ if (callback == null) return;
+ callback.onDeviceFound(launcher.getIntentSender());
+ });
}
@Override
public void onFailure(CharSequence reason) {
- mHandler.post(() -> mCallback.onFailure(reason));
+ Handler handler = mHandler;
+ if (handler == null) return;
+ handler.post(() -> {
+ Callback callback = mCallback;
+ if (callback == null) return;
+ callback.onFailure(reason);
+ });
}
@Override