Skip to content

Conversation

@vaind
Copy link
Collaborator

@vaind vaind commented Sep 24, 2025

Summary

  • Fixes a null reference error in update-changelog.ps1 when no existing bullet points are found in the changelog
  • Adds a test case to prevent regression

Problem

The script was failing with "You cannot call a method on a null-valued expression" when trying to detect what bullet point character to use in changelogs that contained no existing bullet points. This occurred in the sentry-playstation repository update workflow.

Solution

Changed line 183 from:

$bulletPoint = "$($bulletPoint.Trim())-"[0]

to:

$bulletPoint = "$("$bulletPoint".Trim())-"[0]  

By wrapping $bulletPoint in quotes, we convert null values to empty strings before calling .Trim(), which effectively defaults to using "-" as the bullet point character.

Test Plan

  • Added test case no-bullet-points that reproduces the scenario
  • Verified all existing tests still pass
  • Confirmed the fix handles the null case gracefully

🤖 Generated with Claude Code

The script was failing when trying to detect bullet point characters
in changelogs that contained no existing bullet points. This occurred
because the Where-Object filter returned null, and calling .Trim() on
null caused a "You cannot call a method on a null-valued expression" error.

Fixed by wrapping the variable in quotes to convert null to empty string
before calling .Trim(), which effectively defaults to using "-" as the
bullet point character.

Added test case for this scenario to prevent regression.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@vaind vaind marked this pull request as ready for review September 24, 2025 17:58
@vaind
Copy link
Collaborator Author

vaind commented Sep 24, 2025

@sentry review

@vaind vaind merged commit 13193d2 into main Sep 24, 2025
17 checks passed
@vaind vaind deleted the fix/changelog-null-bullet-point branch September 24, 2025 18:02
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