From 940c9a8185cb0c27e03e804b7bdd01cf5a91ec3e Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Tue, 27 Jun 2023 16:16:35 -0700 Subject: Fix some checks --- src/bun.js/bindings/JSReadableState.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/bun.js/bindings/JSReadableState.cpp') diff --git a/src/bun.js/bindings/JSReadableState.cpp b/src/bun.js/bindings/JSReadableState.cpp index 2137e65d5..8a4ee746b 100644 --- a/src/bun.js/bindings/JSReadableState.cpp +++ b/src/bun.js/bindings/JSReadableState.cpp @@ -29,7 +29,7 @@ int64_t getHighWaterMark(JSC::VM& vm, JSC::JSGlobalObject* globalObject, bool is highWaterMarkVal = options->getIfPropertyExists(globalObject, JSC::Identifier::fromString(vm, "readableObjectMode"_s)); } - if (!highWaterMarkVal.isUndefinedOrNull()) { + if (highWaterMarkVal && !highWaterMarkVal.isUndefinedOrNull()) { return highWaterMarkVal.toInt32(globalObject); } } @@ -66,11 +66,11 @@ void JSReadableState::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObj if (options != nullptr) { JSC::JSValue emitCloseVal = options->getIfPropertyExists(globalObject, JSC::Identifier::fromString(vm, "emitClose"_s)); - if (!emitCloseVal.isBoolean() || emitCloseVal.toBoolean(globalObject)) + if (!emitCloseVal || emitCloseVal.toBoolean(globalObject)) setBool(JSReadableState::Mask::emitClose, true); // Has it been destroyed. JSC::JSValue autoDestroyVal = options->getIfPropertyExists(globalObject, JSC::Identifier::fromString(vm, "autoDestroy"_s)); - if (!autoDestroyVal.isBoolean() || autoDestroyVal.toBoolean(globalObject)) + if (!autoDestroyVal || autoDestroyVal.toBoolean(globalObject)) setBool(JSReadableState::Mask::autoDestroy, true); } -- cgit v1.2.3