Skip to content

Fix NPE race condition in AssistantChat.updateLoading#304

Merged
jShiwaniGupta merged 2 commits into
mainfrom
copilot/fix-nullpointerexception-progresshandle
Mar 17, 2026
Merged

Fix NPE race condition in AssistantChat.updateLoading#304
jShiwaniGupta merged 2 commits into
mainfrom
copilot/fix-nullpointerexception-progresshandle

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 17, 2026

updateLoading checked handle != null on the calling thread, but stopLoading() could null out handle before the scheduled invokeLater lambda executed on the EDT, causing a NPE at handle.setDisplayName(progress).

Change

  • Added a null guard for handle inside the invokeLater lambda in updateLoading, so a concurrent stopLoading() call between scheduling and execution is handled safely.
// Before
SwingUtilities.invokeLater(() -> {
    handle.setDisplayName(progress); // NPE if stopLoading() ran before this
});

// After
SwingUtilities.invokeLater(() -> {
    if (handle != null) {
        handle.setDisplayName(progress);
    }
});

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • www.netbeans.org
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.24.3/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.24.3/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.24.3/x64/codeql/xml/tools/xml-extractor.jar --fileList=/tmp/codeql-scratch-cd61c9847ee61009/dbs/java/working/files-to-index17235296391050999240.list --sourceArchiveDir=/tmp/codeql-scratch-cd61c9847ee61009/dbs/java/src --outputDir=/tmp/codeql-scratch-cd61c9847ee61009/dbs/java/trap/java (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

…ondition

Co-authored-by: jGauravGupta <15934072+jGauravGupta@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix NullPointerException in AssistantChat updateLoading method Fix NPE race condition in AssistantChat.updateLoading Mar 17, 2026
Copilot AI requested a review from jGauravGupta March 17, 2026 17:05
@jGauravGupta jGauravGupta marked this pull request as ready for review March 17, 2026 17:06
@jGauravGupta jGauravGupta added this to the 3.4.0 milestone Mar 17, 2026
@jShiwaniGupta jShiwaniGupta merged commit 8dc9257 into main Mar 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants