Skip to content

Commit

Permalink
Merge pull request #701 from stevebroshar/replace-pointer-comparison-…
Browse files Browse the repository at this point in the history
…with-null-checking

Use null check instead of pointer comparison
  • Loading branch information
mvandervoord authored Oct 9, 2023
2 parents dcef17b + 7d0bcc8 commit b175905
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/unity.c
Original file line number Diff line number Diff line change
Expand Up @@ -1609,8 +1609,8 @@ void UnityAssertEqualString(const char* expected,
}
}
else
{ /* handle case of one pointers being null (if both null, test should pass) */
if (expected != actual)
{ /* fail if either null but not if both */
if (expected || actual)
{
Unity.CurrentTestFailed = 1;
}
Expand Down Expand Up @@ -1649,8 +1649,8 @@ void UnityAssertEqualStringLen(const char* expected,
}
}
else
{ /* handle case of one pointers being null (if both null, test should pass) */
if (expected != actual)
{ /* fail if either null but not if both */
if (expected || actual)
{
Unity.CurrentTestFailed = 1;
}
Expand Down

0 comments on commit b175905

Please sign in to comment.