Skip to content

Potential fix for code scanning alert no. 5572: Dereferenced variable is always null#14

Merged
ChristianRosewich merged 1 commit into
masterfrom
alert-autofix-5572
Jul 14, 2026
Merged

Potential fix for code scanning alert no. 5572: Dereferenced variable is always null#14
ChristianRosewich merged 1 commit into
masterfrom
alert-autofix-5572

Conversation

@ChristianRosewich

Copy link
Copy Markdown
Owner

Potential fix for https://github.com/ChristianRosewich/CSharp/security/code-scanning/5572

To fix this safely without changing intended functionality, update the null guard around ubgT so dereferencing only happens when ubgT is not null.

Best single fix in GenFreeWin/GenFreeWin/Gen_FreeWin/ViewModels/PersonenViewModel.cs:

  • In Delete(), change if (ubgT == null) to if (ubgT != null).
  • Keep the existing logic inside the block unchanged (Count, string.Join, confirmation dialog), so behavior remains the same for valid returned collections while preventing null dereference.

No new imports, methods, or dependencies are required.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

… is always null

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@ChristianRosewich ChristianRosewich marked this pull request as ready for review July 14, 2026 12:26
@ChristianRosewich ChristianRosewich merged commit e94c026 into master Jul 14, 2026
1 of 3 checks passed
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.

1 participant