diff --git a/src/app/components/shared/login/login.component.ts b/src/app/components/shared/login/login.component.ts
index 63c92dbe8934c490463c371f43c03ad1f26cfa4e..3624ea85cb8b0cc5876e60e7efe8730d9a5b8814 100644
--- a/src/app/components/shared/login/login.component.ts
+++ b/src/app/components/shared/login/login.component.ts
@@ -133,10 +133,12 @@ export class LoginComponent implements OnInit, OnChanges {
     this.dialog.open(RegisterComponent, {
       width: '350px'
     }).afterClosed().subscribe(result => {
-      this.usernameFormControl.setValue(result.username);
-      this.passwordFormControl.setValue(result.password);
-      this.username = result.username;
-      this.password = result.password;
+      if (result) {
+        this.usernameFormControl.setValue(result.username);
+        this.passwordFormControl.setValue(result.password);
+        this.username = result.username;
+        this.password = result.password;
+      }
     });
   }
 }