Skip to content

🎨 UI/UX: Missing null check before accessing MainWindow.unityInstallationsSource#222

Closed
halinhtvn3a wants to merge 1 commit intounitycoder:masterfrom
halinhtvn3a:contribai/fix/ui/missing-null-check-before-accessing-main
Closed

🎨 UI/UX: Missing null check before accessing MainWindow.unityInstallationsSource#222
halinhtvn3a wants to merge 1 commit intounitycoder:masterfrom
halinhtvn3a:contribai/fix/ui/missing-null-check-before-accessing-main

Conversation

@halinhtvn3a
Copy link

🎨 UI/UX Improvement

Problem

The code accesses MainWindow.unityInstallationsSource without checking if it's null. This can cause a NullReferenceException when the window is opened before the main window has initialized the data source, leading to a crash.

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

Solution

// Add null check before using ItemsSource
if (gridAvailableVersions.ItemsSource == null)
{
if (MainWindow.unityInstallationsSource != null)
{
gridAvailableVersions.ItemsSource = MainWindow.unityInstallationsSource;
}
else
{
// Initialize with empty collection or show message
gridAvailableVersions.ItemsSource = new List();
}
}

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 #221

…tionssource

The code accesses `MainWindow.unityInstallationsSource` without checking if it's null. This can cause a NullReferenceException when the window is opened before the main window has initialized the data source, leading to a crash.

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
Copy link
Owner

thanks ill check these, i dont know why its autoclosed.

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

Quality Gate Failed Quality Gate failed

Failed conditions
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

@unitycoder
Copy link
Owner

same for this: slightly different check and made one additional null check later in the code, so i'll close this.

@unitycoder unitycoder closed this Mar 27, 2026
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: missing null check before accessing mainwindow.unityinstallationssource

2 participants