Skip to content

Commit 68a8004

Browse files
authored
1 parent 0b39e3a commit 68a8004

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

include/simdjson/padded_string-inl.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ inline padded_string::padded_string(const std::string & str_ ) noexcept
6565
// note: do pass std::string_view arguments by value
6666
inline padded_string::padded_string(std::string_view sv_) noexcept
6767
: viable_size(sv_.size()), data_ptr(internal::allocate_padded_buffer(sv_.size())) {
68+
if(simdjson_unlikely(!data_ptr)) {
69+
//allocation failed or zero size
70+
viable_size=0;
71+
return;
72+
}
6873
if (sv_.size()) {
6974
std::memcpy(data_ptr, sv_.data(), sv_.size());
7075
}

0 commit comments

Comments
 (0)