aboutsummaryrefslogtreecommitdiff
path: root/jgvariant-ostree/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'jgvariant-ostree/src/main/java')
-rw-r--r--jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/Checksum.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/Checksum.java b/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/Checksum.java
index 705e27c..ce5f9b0 100644
--- a/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/Checksum.java
+++ b/jgvariant-ostree/src/main/java/eu/mulk/jgvariant/ostree/Checksum.java
@@ -16,6 +16,10 @@ public record Checksum(ByteString byteString) {
private static final Decoder<Checksum> DECODER = ByteString.decoder().map(Checksum::new);
public Checksum {
+ if (byteString.size() == 0) {
+ byteString = zero().byteString;
+ }
+
if (byteString.size() != SIZE) {
throw new IllegalArgumentException(
"attempted to construct Checksum of length %d (expected: %d)"