[Settings] Fixed removeItem removing last item if the item with name provided doesn't exist

pull/39/head
Oj18 3 years ago
parent 0d14573838
commit e9ef970622

@ -25,6 +25,7 @@
- ### Settings API
- Allowed custom elements to be function called
- Fixed removeItem removing last item if the item with name provided doesn't exist
## v8.5.0 [2021-05-10]

@ -103,7 +103,12 @@ export const createItem = (panelName, content, clickHandler, danger = false) =>
};
export const removeItem = (setting) => {
goosemodScope.settings.items.splice(goosemodScope.settings.items.indexOf(goosemodScope.settings.items.find((x) => x[1] === setting)), 1);
const ind = goosemodScope.settings.items.indexOf(goosemodScope.settings.items.find((x) => x[1] === setting));
// Trying to remove non-existant item
if (ind === -1) return false;
goosemodScope.settings.items.splice(ind, 1);
};
export const createHeading = (headingName) => {

Loading…
Cancel
Save