From f00b3f218c1bea0408aab9bf2d5792127d97277f Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Fri, 26 Aug 2022 07:24:32 -0400 Subject: [PATCH] jenkins: guard potentially unset parameter Guard against the `NODEJS_VERSION` parameter not being set, which results in `parameters['NODEJS_VERSION']` being `null`. --- jenkins/scripts/VersionSelectorScript.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jenkins/scripts/VersionSelectorScript.groovy b/jenkins/scripts/VersionSelectorScript.groovy index a3eb96c4e..cda95bdcb 100644 --- a/jenkins/scripts/VersionSelectorScript.groovy +++ b/jenkins/scripts/VersionSelectorScript.groovy @@ -160,7 +160,8 @@ int nodeMajorVersion = -1 if (parameters['NODEJS_MAJOR_VERSION']) nodeMajorVersion = new String(parameters['NODEJS_MAJOR_VERSION']).toInteger() println "Node.js major version: $nodeMajorVersion" -println "Node.js version: ${new String(parameters['NODEJS_VERSION'])}" +if (parameters['NODEJS_VERSION']) + println "Node.js version: ${new String(parameters['NODEJS_VERSION'])}" // NOTE: this assumes that the default "Slaves"->"Name" in the Configuration // Matrix is left as "nodes", if it's changed then `it.nodes` below won't work