From 8303ae54f01fcf8a1cbfdc681593f3390cedb8cc Mon Sep 17 00:00:00 2001 From: MickaelK Date: Thu, 28 Nov 2024 01:50:41 +1100 Subject: [PATCH] fix (fatal): edge case causing fatal issue I've seen the case where someone ran out of disk with a corrupted config file which gave the following fatal error in the login screen: Uncaught TypeError: Cannot read properties of null (reading 'map') with a stacktrace pointing to: ctrl_form.js:22:63 this fixes the assumptions on the config file so as to not trigger the fatal error but head to the nicer error cases where it would say: Internal Error: There is nothing here. which is much nicer for end users than "Cannot read properties of null" --- public/assets/pages/connectpage/ctrl_form.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/assets/pages/connectpage/ctrl_form.js b/public/assets/pages/connectpage/ctrl_form.js index e7e11637..7b90a35c 100644 --- a/public/assets/pages/connectpage/ctrl_form.js +++ b/public/assets/pages/connectpage/ctrl_form.js @@ -19,8 +19,8 @@ import backend$ from "./model_backend.js"; import { setCurrentBackend, getCurrentBackend, getURLParams } from "./ctrl_form_state.js"; const connections$ = config$.pipe( - rxjs.map(({ connections = [], auth = [] }) => connections.map((conn) => { - conn.middleware = auth.indexOf(conn.label) >= 0; + rxjs.map(({ connections, auth }) => (connections || []).map((conn) => { + conn.middleware = (auth || []).indexOf(conn.label) >= 0; return conn; })), rxjs.shareReplay(1),