Skip to content

Fix asserts in Value::setComment #1445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 10, 2024
Merged

Conversation

vslashg
Copy link
Contributor

@vslashg vslashg commented Nov 16, 2022

The existing asserts seem to not be what was intended; they appear to have been mistranslated in pull/877.

The first assert for comment.empty() was previously a check that a provided const char* parameter was not null. The function this replaced accepted empty strings, and the if() statement at the start of this function handles them.

The second assert for comment[0] == '\0' was written when comment was a const char*, and was testing for empty c-string input. This PR replaces it with comment.empty() to match the original intent.

The existing asserts seem to not be what was intended; they appear to have been mistranslated in pull/877.

The first assert for `comment.empty()` was previously a check that a provided `const char*` parameter was not null.  The function this replaced accepted empty strings, and the if() statement at the start of this function handles them.

The second assert for `comment[0] == '\0'` was written when `comment` was a `const char*`, and was testing for empty c-string input.  This PR replaces it with `comment.empty()` to match the original intent.
Copy link
Contributor

@BillyDonahue BillyDonahue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds about right. Thanks!

@baylesj baylesj merged commit e1a3c64 into open-source-parsers:master Sep 10, 2024
6 checks passed
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.

3 participants