RegExpRunner: fix edge case error

This commit is contained in:
Dragory 2020-08-09 16:58:59 +03:00
parent bb823b6274
commit 2d8decdb4f
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -68,7 +68,10 @@ export class RegExpRunner extends EventEmitter {
if (!this._worker) {
this._worker = new RegExpWorker(newWorkerTimeout);
if (newWorkerTimeout !== FINAL_REGEX_TIMEOUT) {
regexTimeoutUpgradePromise.then(() => (this._worker.timeout = FINAL_REGEX_TIMEOUT));
regexTimeoutUpgradePromise.then(() => {
if (!this._worker) return;
this._worker.timeout = FINAL_REGEX_TIMEOUT;
});
}
}