Skip to content

Fix CLI crash when comparison fails before parse diagnostics - #104

Open
Jerry-Johnson-3 wants to merge 1 commit into
criteo:mainfrom
Jerry-Johnson-3:fix/cli-parsing-errors-nre
Open

Jerry-Johnson-3 wants to merge 1 commit into
criteo:mainfrom
Jerry-Johnson-3:fix/cli-parsing-errors-nre

Conversation

@Jerry-Johnson-3

@Jerry-Johnson-3 Jerry-Johnson-3 commented Aug 24, 2026

Copy link
Copy Markdown

Summary

  • Guard parsingErrors?.Any() in the CLI finally block.
  • Add a CLI unit test that feeds readable but unparseable files so Compare throws before out parsingErrors is assigned.

Without the guard, Main throws ArgumentNullException/NullReferenceException instead of returning 1 after a comparison failure.

Testing

  • Red: Main_Returns1_WhenComparisonThrowsBeforeParsingErrorsAreAssigned failed in parsingErrors.Any().
  • Green: the same test returned exit code 1 and printed the comparison error after the null-conditional check.

Avoid a null reference in the finally block when Compare throws before parsing errors are assigned.

Co-authored-by: Cursor <cursoragent@cursor.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.

1 participant