Skip to content

✨ Quality: Potential NullReferenceException when accessing MainWindow.unityInstallationsSource#220

Open
halinhtvn3a wants to merge 1 commit intounitycoder:masterfrom
halinhtvn3a:contribai/improve/quality/potential-nullreferenceexception-when-ac
Open

✨ Quality: Potential NullReferenceException when accessing MainWindow.unityInstallationsSource#220
halinhtvn3a wants to merge 1 commit intounitycoder:masterfrom
halinhtvn3a:contribai/improve/quality/potential-nullreferenceexception-when-ac

Conversation

@halinhtvn3a
Copy link

✨ Code Quality

Problem

The code accesses MainWindow.unityInstallationsSource without null checking.
If this static property is null (e.g., during initialization or if scanning failed),
the assignment gridAvailableVersions.ItemsSource = MainWindow.unityInstallationsSource
will throw a NullReferenceException, crashing the window initialization.
This is a production crash risk.

Severity: medium
File: UnityLauncherPro/UpgradeWindow.xaml.cs

Solution

Add a null check before assignment:

Changes

  • UnityLauncherPro/UpgradeWindow.xaml.cs (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced


🤖 About this PR

This pull request was generated by ContribAI, an AI agent
that helps improve open source projects. The change was:

  1. Discovered by automated code analysis
  2. Generated by AI with context-aware code generation
  3. Self-reviewed by AI quality checks

If you have questions or feedback about this PR, please comment below.
We appreciate your time reviewing this contribution!

Closes #219

…unityinstallationssource

The code accesses `MainWindow.unityInstallationsSource` without null checking.
If this static property is null (e.g., during initialization or if scanning failed),
the assignment `gridAvailableVersions.ItemsSource = MainWindow.unityInstallationsSource`
will throw a NullReferenceException, crashing the window initialization.
This is a production crash risk.


Affected files: UpgradeWindow.xaml.cs

Signed-off-by: halinhtvn3a <77691576+halinhtvn3a@users.noreply.github.com>
@halinhtvn3a
Copy link
Author

Auto-closed: CI checks failed

The following checks failed: SonarCloud Code Analysis

Closing this PR since required CI checks did not pass. Sorry for the inconvenience.

@unitycoder unitycoder reopened this Mar 27, 2026
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
C Maintainability Rating on New Code (required ≥ A)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: potential nullreferenceexception when accessing mainwindow.unityinstallationssource

2 participants