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

Commit 72b20a03 authored by Arthur Hsu's avatar Arthur Hsu
Browse files

GattServer: Check for null for mServerMap.connIdByAddress

We check for null for mServerMap.connIdByAddress in every places
except in SendResponse and SendNotification. This patch properly
fixes that.

Based on ag/1226721

Bug: 62409644 69965109
Test: Build ok
Change-Id: I104f9d0749af389779ecc33b30e31715b17c21c1
parent 86ddcab0
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -63,7 +63,6 @@ import com.android.bluetooth.btservice.ProfileService;
import com.android.bluetooth.util.NumberUtils;
import com.android.internal.annotations.VisibleForTesting;

import java.security.Security;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -2890,9 +2889,9 @@ public class GattService extends ProfileService {
            handle = entry.handle;
        }

        int connId = mServerMap.connIdByAddress(serverIf, address);
        gattServerSendResponseNative(serverIf, connId, requestId, (byte) status, handle, offset,
                value, (byte) 0);
        Integer connId = mServerMap.connIdByAddress(serverIf, address);
        gattServerSendResponseNative(serverIf, connId != null ? connId : 0, requestId,
                (byte) status, handle, offset, value, (byte) 0);
        mHandleMap.deleteRequest(requestId);
    }

@@ -2903,8 +2902,8 @@ public class GattService extends ProfileService {
            Log.d(TAG, "sendNotification() - address=" + address + " handle=" + handle);
        }

        int connId = mServerMap.connIdByAddress(serverIf, address);
        if (connId == 0) {
        Integer connId = mServerMap.connIdByAddress(serverIf, address);
        if (connId == null || connId == 0) {
            return;
        }