Skip to content

Commit

Permalink
Removed redundant null checks and fixed a potential file separator issue
Browse files Browse the repository at this point in the history
  • Loading branch information
MattBDev committed May 12, 2021
1 parent 277046d commit 4c1d0bc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion worldedit-core/src/main/java/com/boydti/fawe/FaweAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public static DiskStorageHistory getChangeSetFromFile(File file) {
if (!file.getName().toLowerCase(Locale.ROOT).endsWith(".bd")) {
throw new IllegalArgumentException("Not a BD file!");
}
String[] path = file.getPath().split(File.separator);
String[] path = file.getPath().split(File.separatorChar=='\\' ? "\\\\" : File.separator);
if (path.length < 3) {
throw new IllegalArgumentException("Not in history directory!");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,9 @@ public byte[] toByteArray() {
// Check if we have a list of buffers
int pos = 0;

if (buffers != null) {
for (byte[] bytes : buffers) {
System.arraycopy(bytes, 0, data, pos, bytes.length);
pos += bytes.length;
}
for (byte[] bytes : buffers) {
System.arraycopy(bytes, 0, data, pos, bytes.length);
pos += bytes.length;
}

// write the internal buffer directly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,11 @@ public void fetchPlacedBlock(BlockState blockState) throws BlockBagException {
}
fetchBlock(blockState);
} catch (OutOfBlocksException e) {
BlockState placed = blockState; // TODO BlockType.getBlockBagItem(id, data);
if (placed == null || placed.getBlockType().getMaterial().isAir()) {
if (blockState.getBlockType().getMaterial().isAir()) {

This comment has been minimized.

Copy link
@NotMyFault

NotMyFault May 12, 2021

Member

Why was this changed sacrificing upstream consistency?

This comment has been minimized.

Copy link
@MattBDev

MattBDev May 12, 2021

Author Contributor

I guess just because I felt like it?

throw e; // TODO: check
}

fetchBlock(placed);
fetchBlock(blockState);
}
}

Expand Down

0 comments on commit 4c1d0bc

Please sign in to comment.