diff --git a/libs/acn/RPTRequestPDU.cpp b/libs/acn/RPTRequestPDU.cpp index 577e382b1..db6179755 100644 --- a/libs/acn/RPTRequestPDU.cpp +++ b/libs/acn/RPTRequestPDU.cpp @@ -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(VECTOR_REQUEST_RDM_CMD)); stack->Write(reinterpret_cast(&vector), sizeof(vector)); diff --git a/libs/acn/RPTRequestPDUTest.cpp b/libs/acn/RPTRequestPDUTest.cpp index d04b88712..f40b30b7a 100644 --- a/libs/acn/RPTRequestPDUTest.cpp +++ b/libs/acn/RPTRequestPDUTest.cpp @@ -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