Fix a bug with splice

This commit is contained in:
Cohee
2024-09-26 23:36:38 +03:00
parent bb82198496
commit 7c4d8b8d7a

View File

@ -241,7 +241,8 @@ async function createConnectionProfile(forceName = null) {
if (excludeState) {
profile.exclude.push(keyName);
} else {
profile.exclude.splice(profile.exclude.indexOf(keyName), 1);
const index = profile.exclude.indexOf(keyName);
index !== -1 && profile.exclude.splice(index, 1);
}
});
const isNameTaken = (n) => extension_settings.connectionManager.profiles.some(p => p.name === n);