Ensure a patch exists after creating it.

This commit is contained in:
CalDescent 2021-08-14 16:54:35 +01:00
parent dd33d24346
commit 179318f1d8

View File

@ -122,6 +122,14 @@ public class ArbitraryDataWriter {
ArbitraryDataCreatePatch patch = new ArbitraryDataCreatePatch(builtPath, this.filePath);
patch.create();
this.filePath = patch.getFinalPath();
// Validate the patch
if (this.filePath == null) {
throw new IllegalStateException("Null path after creating patch");
}
if (FilesystemUtils.isDirectoryEmpty(this.filePath)) {
throw new IllegalStateException("Patch has no content. Either no files have changed, or something went wrong");
}
}
private void compress() {