diff --git a/src/libawkward/builder/ArrayBuilder.cpp b/src/libawkward/builder/ArrayBuilder.cpp index f3c1719efd..d1816b2a80 100644 --- a/src/libawkward/builder/ArrayBuilder.cpp +++ b/src/libawkward/builder/ArrayBuilder.cpp @@ -29,7 +29,9 @@ namespace awkward { void ArrayBuilder::clear() { - builder_.get()->clear(); + if (builder_) { + builder_.get()->clear(); + } } void diff --git a/src/libawkward/builder/BoolBuilder.cpp b/src/libawkward/builder/BoolBuilder.cpp index ccf26a8f1c..a52e4001b8 100644 --- a/src/libawkward/builder/BoolBuilder.cpp +++ b/src/libawkward/builder/BoolBuilder.cpp @@ -34,7 +34,7 @@ namespace awkward { container.copy_buffer(form_key.str() + "-data", buffer_.ptr().get(), - buffer_.length() * (int64_t)sizeof(bool)); + (int64_t)(buffer_.length() * sizeof(bool))); return "{\"class\": \"NumpyArray\", \"primitive\": \"bool\", \"form_key\": \"" + form_key.str() + "\"}"; diff --git a/src/libawkward/builder/GrowableBuffer.cpp b/src/libawkward/builder/GrowableBuffer.cpp index de918d9722..a4d373723b 100644 --- a/src/libawkward/builder/GrowableBuffer.cpp +++ b/src/libawkward/builder/GrowableBuffer.cpp @@ -128,7 +128,7 @@ namespace awkward { GrowableBuffer::clear() { length_ = 0; reserved_ = (size_t) options_.initial(); - ptr_ = nullptr; + ptr_ = UniquePtr(reinterpret_cast(awkward_malloc(options_.initial()*(int64_t)sizeof(T)))); } template