Skip to content

Commit

Permalink
Merge pull request #17058 from Nexus-Mods/17047-bugfix-loadorder-sani…
Browse files Browse the repository at this point in the history
…ty-check

fixed odd case where attempting to update LO with null parameters
  • Loading branch information
insomnious authored Jan 21, 2025
2 parents bff82d2 + e8804ef commit 230bda7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/extensions/file_based_loadorder/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,13 @@ export default function init(context: IExtensionContext) {

context.registerActionCheck('SET_FB_LOAD_ORDER', (state, action: any) => {
const { profileId, loadOrder } = action.payload;
if (!loadOrder || !Array.isArray(loadOrder)) {
log('error', 'invalid load order', loadOrder);
}
const profile = selectors.profileById(state, profileId);
if (updateSet && profile !== undefined) {
updateSet.init(profile.gameId, loadOrder.map((lo, idx) => ({ ...lo, index: idx })));
const gameId = profile?.gameId ?? selectors.activeGameId(state);
if (updateSet && gameId) {
updateSet.init(gameId, (loadOrder ?? []).map((lo, idx) => ({ ...lo, index: idx })));
}
return undefined;
});
Expand Down

0 comments on commit 230bda7

Please sign in to comment.