Skip to content

Commit 2139a87

Browse files
committed
src: handle null backing store in ArrayBufferViewContents::Read
1 parent 8104939 commit 2139a87

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/util-inl.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -591,10 +591,9 @@ void ArrayBufferViewContents<T, S>::Read(v8::Local<v8::ArrayBufferView> abv) {
591591
static_assert(sizeof(T) == 1, "Only supports one-byte data at the moment");
592592
length_ = abv->ByteLength();
593593
if (length_ > sizeof(stack_storage_) || abv->HasBuffer()) {
594-
auto buf = abv->Buffer();
595-
data_ = buf->Data() != nullptr
596-
? static_cast<T*>(buf->Data()) + abv->ByteOffset()
597-
: stack_storage_;
594+
auto buf_data = abv->Buffer()->Data();
595+
data_ = buf_data != nullptr ? static_cast<T*>(buf_data) + abv->ByteOffset()
596+
: stack_storage_;
598597
} else {
599598
abv->CopyContents(stack_storage_, sizeof(stack_storage_));
600599
data_ = stack_storage_;

0 commit comments

Comments
 (0)