diff --git a/src/app/components/shared/statistics-page/statistics-page.component.ts b/src/app/components/shared/statistics-page/statistics-page.component.ts
index c5180511562878f74df929b0b6ebec16044082aa..07eb8be7645e4c131d25d60e2b62f6ff3c480ab9 100644
--- a/src/app/components/shared/statistics-page/statistics-page.component.ts
+++ b/src/app/components/shared/statistics-page/statistics-page.component.ts
@@ -34,7 +34,10 @@ export class StatisticsPageComponent implements OnInit {
   }
 
   ngOnInit(): void {
-    this.currentCG = sessionStorage.getItem('contentGroup');
+    if (sessionStorage.getItem('contentGroup')) {
+      console.log('in if');
+      this.currentCG = sessionStorage.getItem('contentGroup');
+    }
     this.getRoom(localStorage.getItem('roomId'));
     this.tabGroup.selectedIndex = 1;
   }
@@ -44,9 +47,11 @@ export class StatisticsPageComponent implements OnInit {
     this.roomService.getRoom(id).subscribe(room => {
       this.contentGroups = room.contentGroups;
       if (this.contentGroups) {
-        for (let i = 0; i < this.contentGroups.length; i++) {
-          if (this.currentCG.includes(this.contentGroups[i].name)) {
-            this.tabGroup.selectedIndex = i;
+        if( this.currentCG) {
+          for (let i = 0; i < this.contentGroups.length; i++) {
+            if (this.currentCG.includes(this.contentGroups[i].name)) {
+              this.tabGroup.selectedIndex = i;
+            }
           }
         }
       } else {