diff --git a/src/context.ts b/src/context.ts index ff9f447a0..1520581ba 100644 --- a/src/context.ts +++ b/src/context.ts @@ -290,9 +290,11 @@ export namespace CheCtlContext { async function getOpenShiftVersion(): Promise { const { stdout } = await execa('oc', ['version', '-o', 'json'], { timeout: 60_000 }) const versionOutput = JSON.parse(stdout) - const version = (versionOutput.openshiftVersion as string).match(/^\d.\d+/) - if (version) { - return version[0] + if (versionOutput?.openshiftVersion) { + const version = (versionOutput.openshiftVersion as string).match(/^\d.\d+/) + if (version) { + return version[0] + } } return '4.x'