Skip to content

Commit bff82d2

Browse files
authored
Merge pull request #17044 from Nexus-Mods/17028-game-path-validation
Added data validation to game path info provider
2 parents c23c213 + 8e6282a commit bff82d2

File tree

1 file changed

+2
-2
lines changed
  • src/extensions/gamemode_management

1 file changed

+2
-2
lines changed

src/extensions/gamemode_management/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ function init(context: IExtensionContext): boolean {
614614
context.registerModType = registerModType;
615615

616616
context.registerGameInfoProvider('game-path', 0, 1000,
617-
['path'], (game: IGame & IDiscoveryResult) => (game.path === undefined)
617+
['path'], (game: IGame & IDiscoveryResult) => (game.path == null || typeof game.path !== 'string')
618618
? Promise.resolve({})
619619
: Promise.resolve({
620620
path: { title: 'Path', value: path.normalize(game.path), type: 'url' },
@@ -633,7 +633,7 @@ function init(context: IExtensionContext): boolean {
633633
const discoveredGames = context.api.store.getState().settings.gameMode.discovered;
634634
let gamePath = getSafe(discoveredGames, [instanceIds[0], 'path'], undefined);
635635

636-
if (gamePath !== undefined) {
636+
if (gamePath != null) {
637637
if (!gamePath.endsWith(path.sep)) {
638638
gamePath += path.sep;
639639
}

0 commit comments

Comments
 (0)