Skip to content

Commit

Permalink
fix: handle null
Browse files Browse the repository at this point in the history
Throw if editor-version could not be parsed
  • Loading branch information
ComradeVanti committed Oct 24, 2023
1 parent 9108970 commit dd0cc5c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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];
Expand Down

0 comments on commit dd0cc5c

Please sign in to comment.