Skip to content

Commit

Permalink
RPTRequestPDU fix a NPE error in PrependPDU
Browse files Browse the repository at this point in the history
(cherry picked from commit b1dbef0)
  • Loading branch information
peternewman committed Apr 11, 2024
1 parent 564dcb6 commit 10d264a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libs/acn/RPTRequestPDU.cpp
Expand Up @@ -30,6 +30,11 @@ using ola::io::OutputStream;
using ola::network::HostToNetwork;

void RPTRequestPDU::PrependPDU(ola::io::IOStack *stack) {
if (!stack) {
OLA_WARN << "RPTRequestPDU::PrependPDU: missing stack";
return;
}

uint32_t vector = HostToNetwork(
static_cast<uint32_t>(VECTOR_REQUEST_RDM_CMD));
stack->Write(reinterpret_cast<uint8_t*>(&vector), sizeof(vector));
Expand Down
4 changes: 4 additions & 0 deletions libs/acn/RPTRequestPDUTest.cpp
Expand Up @@ -139,6 +139,10 @@ void RPTRequestPDUTest::testPrepend() {
0, 0, 0, 0x01
};
OLA_ASSERT_DATA_EQUALS(expected_data, sizeof(expected_data), buffer, length);

// test null stack
RPTRequestPDU::PrependPDU(NULL);

delete[] buffer;
}
} // namespace acn
Expand Down

0 comments on commit 10d264a

Please sign in to comment.