Skip to content

Fix null-checking logic in IndexView.razor#76

Merged
justinyoo merged 2 commits intofeat/cacading-parametersfrom
copilot/sub-pr-74-again
Jan 2, 2026
Merged

Fix null-checking logic in IndexView.razor#76
justinyoo merged 2 commits intofeat/cacading-parametersfrom
copilot/sub-pr-74-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 2, 2026

The null-checking condition Documents?.Any() == false incorrectly handles null values. When Documents is null, null?.Any() returns null, making null == false evaluate to false, which skips the welcome message and proceeds to iterate over Documents!, risking a NullReferenceException.

Changes:

  • Changed condition from Documents?.Any() == false to Documents?.Any() != true
  • Wrapped foreach loop in else block to ensure it only executes when Documents contains items
@if (Documents?.Any() != true)
{
    <p>Welcome aboard ScissorHands.NET!</p>
}
else
{
    @foreach (var post in Documents!)
    {
        <!-- render post -->
    }
}

This correctly handles all cases:

  • Documents is null → null != true → show welcome
  • Documents is empty → false != true → show welcome
  • Documents has items → true != true → iterate

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: justinyoo <1538528+justinyoo@users.noreply.github.com>
Copilot AI changed the title [WIP] Update cascading parameters for theme views based on feedback Fix null-checking logic in IndexView.razor Jan 2, 2026
Copilot AI requested a review from justinyoo January 2, 2026 05:43
@justinyoo justinyoo marked this pull request as ready for review January 2, 2026 05:52
@justinyoo justinyoo merged commit 127f384 into feat/cacading-parameters Jan 2, 2026
@justinyoo justinyoo deleted the copilot/sub-pr-74-again branch January 2, 2026 05:52
justinyoo added a commit that referenced this pull request Jan 2, 2026
* Update to cascading parameters

* Refactor StaticSiteGenerator

* Refactor ScissorHandsApplication to builder

* Add more tests

* Update README

* Update src/ScissorHands.Web/Generators/StaticSiteGenerator.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Fix null-checking logic in IndexView.razor (#76)

* Initial plan

* Fix null-checking logic in IndexView.razor

Co-authored-by: justinyoo <1538528+justinyoo@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: justinyoo <1538528+justinyoo@users.noreply.github.com>

* Use reflection to discover cascading parameters in ComponentRenderer (#75)

* Initial plan

* Refactor ComponentRenderer to use reflection for cascading parameter detection

Co-authored-by: justinyoo <1538528+justinyoo@users.noreply.github.com>

* Improve reflection to auto-discover cascading parameters from entire Theme assembly

Co-authored-by: justinyoo <1538528+justinyoo@users.noreply.github.com>

* Add error handling and use GetExportedTypes for safer reflection

Co-authored-by: justinyoo <1538528+justinyoo@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: justinyoo <1538528+justinyoo@users.noreply.github.com>

* Improve reflection-based method invocation with caching and error handling (#77)

* Initial plan

* Add robust error handling and caching for reflection-based method invocation

Co-authored-by: justinyoo <1538528+justinyoo@users.noreply.github.com>

* Add thread-safety and improve exception handling

Co-authored-by: justinyoo <1538528+justinyoo@users.noreply.github.com>

* Address final code review feedback - constants and stack trace preservation

Co-authored-by: justinyoo <1538528+justinyoo@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: justinyoo <1538528+justinyoo@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: justinyoo <1538528+justinyoo@users.noreply.github.com>
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.

2 participants