diff --git a/src/main/java/com/github/fppt/jedismock/operations/strings/SetRange.java b/src/main/java/com/github/fppt/jedismock/operations/strings/SetRange.java index 5822abcb..10fbbb77 100644 --- a/src/main/java/com/github/fppt/jedismock/operations/strings/SetRange.java +++ b/src/main/java/com/github/fppt/jedismock/operations/strings/SetRange.java @@ -25,13 +25,14 @@ protected Slice response() { if (offset < 0) { return Response.error("ERR offset is out of range"); } - Slice value = params().get(2); + Slice value = params().get(2); String oldValue = Optional.ofNullable(base().getRMString(key)) .map(RMString::getStoredDataAsString) .orElse(""); String padding = ""; - if (offset + value.length() > base().getProtoMaxBulkLen()) + if (offset + value.length() > base().getProtoMaxBulkLen()) { return Response.error("ERR string exceeds maximum allowed size (proto-max-bulk-len)"); + } if (offset > oldValue.length()) { padding = new String(new byte[offset - oldValue.length()]); }