Skip to content
Snippets Groups Projects
Commit c3f476c7 authored by RMidhunSuresh's avatar RMidhunSuresh
Browse files

Check condition outside loop

parent f1056023
No related branches found
No related tags found
No related merge requests found
......@@ -28,13 +28,13 @@ export class AccountSetupViewModel extends ViewModel {
this._registration = await this._client.startRegistration(this._homeserver, username, this._password, "Chatterbox");
this._startStage = await this._registration.start();
let stage = this._startStage;
while (stage.type !== "m.login.terms") {
while (stage && stage.type !== "m.login.terms") {
stage = stage.nextStage;
if (!stage) {
// If terms login stage is not found, go straight to completeRegistration()
this.completeRegistration();
return;
}
}
if (!stage) {
// If terms login stage is not found, go straight to completeRegistration()
this.completeRegistration();
return;
}
this._privacyPolicyLink = stage.privacyPolicy.en?.url;
this.emitChange("privacyPolicyLink");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment