From 842fe36c7e7ae524fe8ede8f80a2750db49d7fca Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 2 Feb 2021 17:28:52 +0000 Subject: [PATCH] Fix register exploding if the server is down or we just don't have flows --- src/components/structures/auth/Login.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/structures/auth/Login.tsx b/src/components/structures/auth/Login.tsx index 606aeb44ab..a217f1b4d9 100644 --- a/src/components/structures/auth/Login.tsx +++ b/src/components/structures/auth/Login.tsx @@ -340,8 +340,8 @@ export default class LoginComponent extends React.PureComponent }; onTryRegisterClick = ev => { - const hasPasswordFlow = this.state.flows.find(flow => flow.type === "m.login.password"); - const ssoFlow = this.state.flows.find(flow => flow.type === "m.login.sso" || flow.type === "m.login.cas"); + const hasPasswordFlow = this.state.flows?.find(flow => flow.type === "m.login.password"); + const ssoFlow = this.state.flows?.find(flow => flow.type === "m.login.sso" || flow.type === "m.login.cas"); // If has no password flow but an SSO flow guess that the user wants to register with SSO. // TODO: instead hide the Register button if registration is disabled by checking with the server, // has no specific errCode currently and uses M_FORBIDDEN.