Skip to content

Commit

Permalink
Removed redundant nullptr checks
Browse files Browse the repository at this point in the history
  • Loading branch information
mbknust committed Apr 19, 2024
1 parent d8cd6c5 commit c104853
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/lib/core/tests/TestTLV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,7 @@ void TestDupString(TLVReader & reader, Tag tag, const char * expectedVal)
CHIP_ERROR err = reader.DupString(val);
EXPECT_EQ(err, CHIP_NO_ERROR);
ASSERT_NE(val, nullptr);
if (val != nullptr)
{
EXPECT_EQ(memcmp(val, expectedVal, expectedLen + 1), 0);
}
EXPECT_EQ(memcmp(val, expectedVal, expectedLen + 1), 0);
chip::Platform::MemoryFree(val);
}

Expand All @@ -268,10 +265,7 @@ void TestDupBytes(TLVReader & reader, Tag tag, const uint8_t * expectedVal, uint
CHIP_ERROR err = reader.DupBytes(val, expectedLen);
EXPECT_EQ(err, CHIP_NO_ERROR);
ASSERT_NE(val, nullptr);
if (val != nullptr)
{
EXPECT_EQ(memcmp(val, expectedVal, expectedLen), 0);
}
EXPECT_EQ(memcmp(val, expectedVal, expectedLen), 0);
chip::Platform::MemoryFree(val);
}

Expand Down

0 comments on commit c104853

Please sign in to comment.