Problem
In GithubStatusNotificationHandler.BuildStatusMessage(), the code unconditionally accesses message.Branches[^1]:
Branch lastBranch = message.Branches[^1];
If the GitHub status payload arrives with an empty Branches list, this throws IndexOutOfRangeException, crashing the handler.
Location
src/BuildBot.GitHub/Publishers/GithubStatusNotificationHandler.cs — BuildStatusMessage method
Fix
Guard with a null/empty check, or use a safe accessor such as:
Branch? lastBranch = message.Branches.Count > 0 ? message.Branches[^1] : null;
And handle the null case gracefully in the embed title.
Discovery
Identified during code review of PR #364 (coverage task). Not introduced by that PR — pre-existing gap.
Problem
In
GithubStatusNotificationHandler.BuildStatusMessage(), the code unconditionally accessesmessage.Branches[^1]:If the GitHub status payload arrives with an empty
Brancheslist, this throwsIndexOutOfRangeException, crashing the handler.Location
src/BuildBot.GitHub/Publishers/GithubStatusNotificationHandler.cs—BuildStatusMessagemethodFix
Guard with a null/empty check, or use a safe accessor such as:
And handle the null case gracefully in the embed title.
Discovery
Identified during code review of PR #364 (coverage task). Not introduced by that PR — pre-existing gap.