From dd0cc5cafec74635ae31e2d376d3e9080b32a242 Mon Sep 17 00:00:00 2001 From: ComradeVanti Date: Tue, 24 Oct 2023 10:35:33 +0200 Subject: [PATCH] fix: handle null Throw if editor-version could not be parsed --- lib/core.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/core.ts b/lib/core.ts index 100563b2..30246215 100644 --- a/lib/core.ts +++ b/lib/core.ts @@ -434,6 +434,10 @@ export const saveUpmConfig = async function ( export const compareEditorVersion = function (a: string, b: string) { const verA = parseEditorVersion(a); const verB = parseEditorVersion(b); + + if (verA === null || verB === null) + throw new Error("An editor version could not be parsed"); + const editorVersionToArray = (ver: SemanticVersion) => [ ver.major, ver.minor, @@ -443,10 +447,7 @@ export const compareEditorVersion = function (a: string, b: string) { ver.locValue || 0, ver.locBuild || 0, ]; - // TODO: Handle null - // @ts-ignore const arrA = editorVersionToArray(verA); - // @ts-ignore const arrB = editorVersionToArray(verB); for (let i = 0; i < arrA.length; i++) { const valA = arrA[i];