From b98be569eae2969e7e247b0c527a6b073183be2b Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Thu, 4 Nov 2021 10:47:03 +0100 Subject: [PATCH] MOBILE-3905 core: Fix getting snapshot params --- src/core/services/navigator.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/services/navigator.ts b/src/core/services/navigator.ts index 6e5e471de..52455ad12 100644 --- a/src/core/services/navigator.ts +++ b/src/core/services/navigator.ts @@ -264,14 +264,16 @@ export class CoreNavigatorService { * @return Value of the parameter, undefined if not found. */ protected getRouteSnapshotParam(name: string, route?: ActivatedRoute): T | undefined { - if (!route?.snapshot) { + if (!route) { return; } - const value = route.snapshot.queryParams[name] ?? route.snapshot.params[name]; + if (route.snapshot) { + const value = route.snapshot.queryParams[name] ?? route.snapshot.params[name]; - if (value !== undefined) { - return value; + if (value !== undefined) { + return value; + } } return this.getRouteSnapshotParam(name, route.parent || undefined);