diff --git a/Tasks/JenkinsDownloadArtifactsV1/ArtifactDetails/JenkinsRestClient.ts b/Tasks/JenkinsDownloadArtifactsV1/ArtifactDetails/JenkinsRestClient.ts index a30c8ab67cb6..18e644f3a562 100644 --- a/Tasks/JenkinsDownloadArtifactsV1/ArtifactDetails/JenkinsRestClient.ts +++ b/Tasks/JenkinsDownloadArtifactsV1/ArtifactDetails/JenkinsRestClient.ts @@ -161,22 +161,19 @@ export class JenkinsRestClient { let result = null; if (!!array && !!property) { - let maxValue: number = parseInt(GetJsonProperty(array[0], property)); - - if (!isNaN(maxValue)) { - result = array[0]; //consider first as result until we figure out if there are any other max available - - for(let i = 1; i < array.length; i++) { - let value: number = parseInt(GetJsonProperty(array[i], property)); - tl.debug(`#selectMaxOf comparing values ${maxValue} and ${value}`); - if (!isNaN(value) && value > maxValue) { - result = array[i]; - maxValue = value; - } - } - - tl.debug(`Found maxvalue ${maxValue}`); + let maxValue: number = 0; + result = array[0]; //consider first as result until we figure out if there are any other max available + + for(let i = 0; i < array.length; i++) { + let value: number = parseInt(GetJsonProperty(array[i], property)); + tl.debug(`#selectMaxOf comparing values ${maxValue} and ${value}`); + if (!isNaN(value) && value > maxValue) { + result = array[i]; + maxValue = value; + } } + + tl.debug(`Found maxvalue ${maxValue}`); } return result; diff --git a/Tasks/JenkinsDownloadArtifactsV1/task.json b/Tasks/JenkinsDownloadArtifactsV1/task.json index 4479b2c8480d..8e7f263e84ba 100644 --- a/Tasks/JenkinsDownloadArtifactsV1/task.json +++ b/Tasks/JenkinsDownloadArtifactsV1/task.json @@ -18,7 +18,7 @@ "demands": [], "version": { "Major": 1, - "Minor": 154, + "Minor": 155, "Patch": 0 }, "groups": [ diff --git a/Tasks/JenkinsDownloadArtifactsV1/task.loc.json b/Tasks/JenkinsDownloadArtifactsV1/task.loc.json index 2e7b86534b1b..51b3496efb59 100644 --- a/Tasks/JenkinsDownloadArtifactsV1/task.loc.json +++ b/Tasks/JenkinsDownloadArtifactsV1/task.loc.json @@ -18,7 +18,7 @@ "demands": [], "version": { "Major": 1, - "Minor": 154, + "Minor": 155, "Patch": 0 }, "groups": [