From ef306cbb67ed5e58de577df5e1f18a47eaf59805 Mon Sep 17 00:00:00 2001 From: IDCs Date: Mon, 26 Feb 2024 08:08:38 +0000 Subject: [PATCH] ensure we block invalid file override types (#15268) --- src/extensions/mod_management/reducers/mods.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/extensions/mod_management/reducers/mods.ts b/src/extensions/mod_management/reducers/mods.ts index 009c31b4a..9e26f46ee 100644 --- a/src/extensions/mod_management/reducers/mods.ts +++ b/src/extensions/mod_management/reducers/mods.ts @@ -173,10 +173,17 @@ export const modsReducer: IReducerSpec = { }, [actions.setFileOverride as any]: (state, payload) => { const { gameId, modId, files } = payload; - + if (!Array.isArray(files)) { + // this should never happen + return state; + } if (state[gameId]?.[modId] === undefined) { return state; } + const hasInvalidEntry = files.find(file => (typeof file !== 'string')) !== undefined; + if (hasInvalidEntry) { + return state; + } return setSafe(state, [gameId, modId, 'fileOverrides'], files); },