diff options
author | 2023-06-27 16:16:35 -0700 | |
---|---|---|
committer | 2023-06-27 16:16:47 -0700 | |
commit | 940c9a8185cb0c27e03e804b7bdd01cf5a91ec3e (patch) | |
tree | 3c3076edf0f8bbe405a96f340706eb0895fa0288 /src/bun.js/bindings/JSReadableState.cpp | |
parent | 28d7507a5da07591395c4b66b091ac6b5e3655a0 (diff) | |
download | bun-940c9a8185cb0c27e03e804b7bdd01cf5a91ec3e.tar.gz bun-940c9a8185cb0c27e03e804b7bdd01cf5a91ec3e.tar.zst bun-940c9a8185cb0c27e03e804b7bdd01cf5a91ec3e.zip |
Fix some checks
Diffstat (limited to 'src/bun.js/bindings/JSReadableState.cpp')
-rw-r--r-- | src/bun.js/bindings/JSReadableState.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
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); } |