Skip to content

Commit

Permalink
Merge pull request #16875 from Snuffleupagus/more-optional-chaining-4
Browse files Browse the repository at this point in the history
Introduce more optional chaining in the code-base
  • Loading branch information
timvandermeij committed Aug 27, 2023
2 parents 598421b + ec3d2be commit e142bae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
5 changes: 2 additions & 3 deletions src/core/worker_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ class PDFWorkerStream {
}

cancelAllRequests(reason) {
if (this._fullRequestReader) {
this._fullRequestReader.cancel(reason);
}
this._fullRequestReader?.cancel(reason);

for (const reader of this._rangeRequestReaders.slice(0)) {
reader.cancel(reason);
}
Expand Down
6 changes: 1 addition & 5 deletions src/display/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -3153,11 +3153,7 @@ class PDFObjects {
* @returns {Object}
*/
#ensureObj(objId) {
const obj = this.#objs[objId];
if (obj) {
return obj;
}
return (this.#objs[objId] = {
return (this.#objs[objId] ||= {
capability: new PromiseCapability(),
data: null,
});
Expand Down
4 changes: 1 addition & 3 deletions src/pdf.sandbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ class Sandbox {
}

dumpMemoryUse() {
if (this._module) {
this._module.ccall("dumpMemoryUse", null, []);
}
this._module?.ccall("dumpMemoryUse", null, []);
}

nukeSandbox() {
Expand Down

0 comments on commit e142bae

Please sign in to comment.