Skip to content

Potential fix for code scanning alert no. 5573: Dereferenced variable is always null#13

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

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

Conversation

@ChristianRosewich

Copy link
Copy Markdown
Owner

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

The fix is to stop using the uninitialized text variable for numeric comparisons and use the already-selected event art value (eArt) directly.

Best minimal fix without changing functionality:

  • In GenFreeWin/GenFreeWin/Gen_FreeWin/ViewModels/RegSuchViewModel.cs, in the else branch where eArt is computed and eArt < EEventArt.eA_500 is checked:
    • Replace if (text.AsInt() != 0.0) with if ((int)eArt != 0).
    • Replace DataModul.DB_EventTable.Fields[EventFields.Art].AsInt() == text.AsInt() with ... == (int)eArt.
  • No imports or new methods are required.
  • This keeps behavior aligned with the existing Seek(">=", (int)eArt, Text1_Text) call and avoids null dereference.

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:24
@ChristianRosewich ChristianRosewich merged commit 3e8d109 into master Jul 14, 2026
1 of 3 checks passed
@ChristianRosewich ChristianRosewich deleted the alert-autofix-5573 branch July 14, 2026 12:25
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