Merge pull request #843 from keepassxreboot/fix/check_undefined_new_creds

Check undefined when saving credentials
This commit is contained in:
Sami Vänttinen 2020-04-11 11:02:45 +03:00 committed by GitHub
commit 04746c4d19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -151,7 +151,10 @@ kpxcBanner.saveNewCredentials = async function(credentials = {}) {
const args = [ credentials.username, credentials.password, credentials.url ];
// If root group is defined by the user, and there's no default browser group, save the credentials to the root group
if (result.groups[0].children.length === 0 && result.defaultGroup.toLowerCase() === 'root') {
if (result.groups !== undefined
&& result.groups.length > 0
&& result.groups[0].children.length === 0
&& result.defaultGroup.toLowerCase() === 'root') {
args.push(result.groups[0].name, result.groups[0].uuid);
}