Skip to content

Commit

Permalink
ensure we block invalid file override types (#15268)
Browse files Browse the repository at this point in the history
  • Loading branch information
IDCs authored Feb 26, 2024
1 parent 11efd0b commit ef306cb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/extensions/mod_management/reducers/mods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
Expand Down

0 comments on commit ef306cb

Please sign in to comment.