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

Commit 5d03ae81 authored by Matthew Sedam's avatar Matthew Sedam
Browse files

Fix NPE in ContextHubTransactionManager

This CL fixes a NullPointerException that can occur in ContextHubTransactionManager when a null transaction is added to the transaction queue.

Bug: N/A
Change-Id: I4027fd6ed3af89dfad06927f6085701dcd4e230a
Flag: EXEMPT bugfix
Test: Presubmits
parent 441a51dd
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -412,10 +412,15 @@ import java.util.concurrent.atomic.AtomicInteger;
    /* package */
    synchronized void addTransaction(
            ContextHubServiceTransaction transaction) throws IllegalStateException {
        if (transaction == null) {
            return;
        }

        if (mTransactionQueue.size() == MAX_PENDING_REQUESTS) {
            throw new IllegalStateException("Transaction queue is full (capacity = "
                    + MAX_PENDING_REQUESTS + ")");
        }

        mTransactionQueue.add(transaction);
        mTransactionRecordDeque.add(new TransactionRecord(transaction.toString()));