From 54502c906f77ddc387b883ff4151917de086c58a Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 5 May 2020 23:19:02 +0200 Subject: [PATCH] make disposeTracked suitable to reassign member --- src/utils/Disposables.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/utils/Disposables.js b/src/utils/Disposables.js index 8d90b8c6..e1d6b0a5 100644 --- a/src/utils/Disposables.js +++ b/src/utils/Disposables.js @@ -25,12 +25,16 @@ export class Disposables { } disposeTracked(value) { + if (value === undefined || value === null) { + return null; + } const idx = this._disposables.indexOf(value); if (idx !== -1) { const [foundValue] = this._disposables.splice(idx, 1); disposeValue(foundValue); - return true; + } else { + console.warn("disposable not found, did it leak?", value); } - return false; + return null; } }