From 940eefb5509f35cf3375f8951b00f20917d716db Mon Sep 17 00:00:00 2001 From: Kir_Antipov Date: Wed, 3 Jan 2024 18:35:57 +0000 Subject: [PATCH] Fixed null-handling in game version comparers --- src/platforms/curseforge/curseforge-game-version.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/platforms/curseforge/curseforge-game-version.ts b/src/platforms/curseforge/curseforge-game-version.ts index 87a233f..d521cbe 100644 --- a/src/platforms/curseforge/curseforge-game-version.ts +++ b/src/platforms/curseforge/curseforge-game-version.ts @@ -31,10 +31,10 @@ export interface CurseForgeGameVersion { * An equality comparer that compares two game version names ignoring the "-Snapshot" suffix. */ export const CURSEFORGE_GAME_VERSION_SNAPSHOT_NAME_COMPARER: EqualityComparer = (a, b) => { - const aVersion = a.replace("-Snapshot", ""); - const bVersion = b.replace("-Snapshot", ""); + const aVersion = a?.replace("-Snapshot", ""); + const bVersion = b?.replace("-Snapshot", ""); - return aVersion && bVersion && aVersion === bVersion; + return aVersion === bVersion; }; /** @@ -43,10 +43,10 @@ export const CURSEFORGE_GAME_VERSION_SNAPSHOT_NAME_COMPARER: EqualityComparer = (a, b) => { - const aVersion = a.match(/\d+\.\d+/)?.[0]; - const bVersion = b.match(/\d+\.\d+/)?.[0]; + const aVersion = a?.match(/\d+\.\d+/)?.[0]; + const bVersion = b?.match(/\d+\.\d+/)?.[0]; - return aVersion && bVersion && aVersion === bVersion; + return aVersion === bVersion; }; /**