Skip to content

Commit 9f2a5c8

Browse files
committed
Require bytes greater 0
1 parent 02f59df commit 9f2a5c8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

smack-extensions/src/main/java/org/jivesoftware/smackx/avatar/MetadataInfo.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ public class MetadataInfo {
5555
public MetadataInfo(String id, URL url, long bytes, String type, int pixelsHeight, int pixelsWidth) {
5656
this.id = StringUtils.requireNotNullNorEmpty(id, "ID is required.");
5757
this.url = url;
58+
if (bytes <= 0) {
59+
throw new IllegalArgumentException("Number of bytes MUST be greater than 0.");
60+
}
5861
this.bytes = UInt32.from(bytes);
5962
this.type = StringUtils.requireNotNullNorEmpty(type, "Content Type is required.");
6063
if (pixelsHeight < 0 || pixelsHeight > MAX_HEIGHT) {

0 commit comments

Comments
 (0)