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

Commit bf6c7fd5 authored by Arthur Ishiguro's avatar Arthur Ishiguro
Browse files

Fix NPE in onTransactionResponse callback

Bug: 380872826
Test: CHQTS pass, inject manual failure case and confirm no crash
Flag: EXEMPT bug fix
Change-Id: I7bd410666049f5d09bc18e966111e665aea90717
parent fc83498d
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -492,14 +492,21 @@ import java.util.concurrent.atomic.AtomicInteger;
    /* package */
    void onTransactionResponse(int transactionId, boolean success) {
        TransactionAcceptConditions conditions =
                transaction -> transaction.getTransactionId() == transactionId;
                transaction -> {
                    if (transaction.getTransactionId() != transactionId) {
                        Log.w(
                                TAG,
                                "Unexpected transaction: expected "
                                        + transactionId
                                        + ", received "
                                        + transaction.getTransactionId());
                        return false;
                    }
                    return true;
                };
        ContextHubServiceTransaction transaction = getTransactionAndHandleNext(conditions);
        if (transaction == null) {
            Log.w(TAG, "Received unexpected transaction response (expected ID = "
                    + transactionId
                    + ", received ID = "
                    + transaction.getTransactionId()
                    + ")");
            Log.w(TAG, "Received unexpected transaction response");
            return;
        }

@@ -581,7 +588,7 @@ import java.util.concurrent.atomic.AtomicInteger;
                transaction.getTransactionType() == ContextHubTransaction.TYPE_QUERY_NANOAPPS;
        ContextHubServiceTransaction transaction = getTransactionAndHandleNext(conditions);
        if (transaction == null) {
            Log.w(TAG, "Received unexpected query response (expected " + transaction + ")");
            Log.w(TAG, "Received unexpected query response");
            return;
        }