Fix null check for pos1 and pos2

This commit is contained in:
tastybento 2019-05-18 16:02:12 -07:00
parent 7ea0edea91
commit 259cb19cf3

View File

@ -314,11 +314,13 @@ public class BlueprintClipboard {
*/ */
public void setPos1(@Nullable Location pos1) { public void setPos1(@Nullable Location pos1) {
origin = null; origin = null;
if (pos1.getBlockY() < 0) { if (pos1 != null) {
pos1.setY(0); if (pos1.getBlockY() < 0) {
} pos1.setY(0);
if (pos1.getBlockY() > 255) { }
pos1.setY(255); if (pos1.getBlockY() > 255) {
pos1.setY(255);
}
} }
this.pos1 = pos1; this.pos1 = pos1;
} }
@ -328,11 +330,13 @@ public class BlueprintClipboard {
*/ */
public void setPos2(@Nullable Location pos2) { public void setPos2(@Nullable Location pos2) {
origin = null; origin = null;
if (pos2.getBlockY() < 0) { if (pos2 != null) {
pos2.setY(0); if (pos2.getBlockY() < 0) {
} pos2.setY(0);
if (pos2.getBlockY() > 255) { }
pos2.setY(255); if (pos2.getBlockY() > 255) {
pos2.setY(255);
}
} }
this.pos2 = pos2; this.pos2 = pos2;
} }