diff --git a/src/data-model-providers/codegen/EmberAttributeDataBuffer.cpp b/src/data-model-providers/codegen/EmberAttributeDataBuffer.cpp index 84ad9de070ff2d..f8f041f6ee2e38 100644 --- a/src/data-model-providers/codegen/EmberAttributeDataBuffer.cpp +++ b/src/data-model-providers/codegen/EmberAttributeDataBuffer.cpp @@ -244,6 +244,7 @@ CHIP_ERROR EmberAttributeDataBuffer::DecodeAsString(chip::TLV::TLVReader & reade // data copy const uint8_t * tlvData; ReturnErrorOnFailure(reader.GetDataPtr(tlvData)); + VerifyOrReturnError(tlvData != nullptr, CHIP_ERROR_INVALID_TLV_ELEMENT); writer.Put(tlvData, stringLength); return CHIP_NO_ERROR;