Use safe navigation operator for correct field

when checking the time of previous build.
Handles an edge case when there is the very first build for the branch
This commit is contained in:
Waldemar Zurowski 2020-09-16 09:52:41 +02:00
parent 0226f7ccb9
commit 6ab9557061

View File

@ -248,7 +248,7 @@ pipeline {
// Comparing the dates of the previous and current builds achieves this,
// i.e. we will only send an email for the first build on a given day.
def prevBuildDate = new Date(
currentBuild?.previousBuild.timeInMillis ?: 0).clearTime()
currentBuild.previousBuild?.timeInMillis ?: 0).clearTime()
def currentBuildDate = new Date(
currentBuild.timeInMillis).clearTime()