diff --git a/src/components/pages/NewUserPage.tsx b/src/components/pages/NewUserPage.tsx index 4e4622a561..bf1e5327c5 100644 --- a/src/components/pages/NewUserPage.tsx +++ b/src/components/pages/NewUserPage.tsx @@ -111,6 +111,14 @@ const NewUserPage: FunctionComponent = () => { userInput.Name = (page.querySelector('#txtUsername') as HTMLInputElement).value; userInput.Password = (page.querySelector('#txtPassword') as HTMLInputElement).value; window.ApiClient.createUser(userInput).then(function (user) { + if (!user.Id) { + throw new Error('Unexpected null user.Id'); + } + + if (!user.Policy) { + throw new Error('Unexpected null user.Policy'); + } + user.Policy.EnableAllFolders = (page.querySelector('.chkEnableAllFolders') as HTMLInputElement).checked; user.Policy.EnabledFolders = [];