Avoid TypeError when lastBuild is null