Merge pull request #4168 from Egor18/fixCounter

Fix counter which is not updated in the loop
This commit is contained in:
Oleg Nenashev authored and GitHub committed 2019-08-30 10:13:40 +02:00
commit 9e8df8a91e
1 file changed
+2 -4
@@ -553,8 +553,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
* @return null if no such build exists.
*/
public final R getSomeBuildWithWorkspace() {
int cnt=0;
for (R b = getLastBuild(); cnt<5 && b!=null; b=b.getPreviousBuild()) {
for (R b = getLastBuild(); b != null; b = b.getPreviousBuild()) {
FilePath ws = b.getWorkspace();
if (ws!=null) return b;
}
@@ -562,8 +561,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
}
private R getSomeBuildWithExistingWorkspace() throws IOException, InterruptedException {
int cnt=0;
for (R b = getLastBuild(); cnt<5 && b!=null; b=b.getPreviousBuild()) {
for (R b = getLastBuild(); b != null; b = b.getPreviousBuild()) {
FilePath ws = b.getWorkspace();
if (ws!=null && ws.exists()) return b;
}