Skip to content

Commit

Permalink
Fix Tests: Block.set: Do not return null pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
Der-Schubi committed Dec 20, 2023
1 parent cd2c4dc commit 4a9b033
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,14 @@ public String toString() {
}

public Block set(final int top, final int bottom) {
if (top < 0 || bottom < 0) return null;
this.top = top;
this.bottom = bottom;
if (top < 0 || bottom < 0)
{
this.top = 0;
this.bottom = 0;
} else {
this.top = top;
this.bottom = bottom;
}
return this;
}
}
Expand Down Expand Up @@ -107,7 +112,7 @@ public int findRandomAvailablePositionWithFailSafe(final int height, final int m
}
}
// FailSafe
return new Random().nextInt(maxHeight);
return new Random().nextInt(bound);
}


Expand Down

0 comments on commit 4a9b033

Please sign in to comment.