diff --git a/ember_debug/route-debug.js b/ember_debug/route-debug.js index 45624b801a..9cdfea5c7f 100644 --- a/ember_debug/route-debug.js +++ b/ember_debug/route-debug.js @@ -36,7 +36,10 @@ export default class RouteDebug extends DebugPort { } get router() { - if (this.namespace?.owner.isDestroyed) { + if ( + this.namespace?.owner.isDestroyed || + this.namespace?.owner.isDestroying + ) { return null; } return this.namespace?.owner.lookup('router:main'); @@ -74,6 +77,12 @@ export default class RouteDebug extends DebugPort { } get routeTree() { + if ( + this.namespace?.owner.isDestroyed || + this.namespace?.owner.isDestroying + ) { + return null; + } if (!this._cachedRouteTree && this.router) { const router = this.router; const routerLib = router._routerMicrolib || router.router;