From 7a6228b13695ea889147502332e016ab2c941301 Mon Sep 17 00:00:00 2001 From: gpapavgeri Date: Thu, 27 Aug 2020 17:38:07 +0300 Subject: [PATCH] Fixed error ''Cannot read property 'firstChild' of null'' after Login --- dmp-frontend/src/app/app.component.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dmp-frontend/src/app/app.component.ts b/dmp-frontend/src/app/app.component.ts index 7fd33fb2d..cde53ffed 100644 --- a/dmp-frontend/src/app/app.component.ts +++ b/dmp-frontend/src/app/app.component.ts @@ -91,11 +91,13 @@ export class AppComponent implements OnInit { filter(event => event instanceof NavigationEnd), map(() => { let child = this.route.firstChild; - while (child.firstChild) { - child = child.firstChild; - } - if (child.snapshot.data['title']) { - return child.snapshot.data['title']; + if (child != null) { + while (child.firstChild) { + child = child.firstChild; + } + if (child.snapshot.data['title']) { + return child.snapshot.data['title']; + } } return appTitle; })