From 710f9ee1ac91e9c0465a86c59b6bdd201d25e597 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Wed, 5 Dec 2018 11:28:53 -0800 Subject: [PATCH] Relax overly-strict assert in Serializer constructor (RIPD-1701): The constructor would previously assert that the specified buffer pointer was non-null, even if the buffer size is specified as 0. While reasonable, this also makes it more difficult to use this API. --- src/ripple/protocol/Serializer.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ripple/protocol/Serializer.h b/src/ripple/protocol/Serializer.h index ab6ce13aa2..6192be29e2 100644 --- a/src/ripple/protocol/Serializer.h +++ b/src/ripple/protocol/Serializer.h @@ -51,12 +51,13 @@ public: Serializer (void const* data, std::size_t size) { - assert(!data == !size); - mData.resize(size); if (size) + { + assert(data != nullptr); std::memcpy(mData.data(), data, size); + } } Slice slice() const noexcept