Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3f7c31fd authored by Arman Uguray's avatar Arman Uguray
Browse files

service: Check for NULL IBinder in registerCallback

Added checks for NULL binder in IBluetooth.registerCallback and
IBluetooth.unregisterCallback.

Change-Id: I6136ad08d83696ad0e94cc2425667df9310f2b96
parent 8f84dde9
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -80,12 +80,20 @@ std::string BluetoothBinderServer::GetName() {
void BluetoothBinderServer::RegisterCallback(
    const android::sp<IBluetoothCallback>& callback) {
  VLOG(2) << __func__;
  if (!callback.get() ) {
    LOG(ERROR) << "RegisterCallback called with NULL binder. Ignoring.";
    return;
  }
  callbacks_.Register(callback);
}

void BluetoothBinderServer::UnregisterCallback(
    const android::sp<IBluetoothCallback>& callback) {
  VLOG(2) << __func__;
  if (!callback.get() ) {
    LOG(ERROR) << "UnregisterCallback called with NULL binder. Ignoring.";
    return;
  }
  callbacks_.Unregister(callback);
}