Skip to content

Commit 62a04f0

Browse files
committed
Fix byte_array min required space allocation
1 parent 64deb06 commit 62a04f0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/com/laytonsmith/core/constructs/CByteArray.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private void checkSize(int need, Integer pos) {
100100
maxValue = Math.max(maxValue, spos + need);
101101
//Reallocate if needed
102102
if(spos + need >= data.limit()) {
103-
int newSize = data.limit() * SCALE_MULTIPLIER;
103+
int newSize = Math.max(data.limit() * SCALE_MULTIPLIER, spos + need);
104104
if(newSize <= 0) {
105105
//Protect from this happening
106106
newSize = 1;

0 commit comments

Comments
 (0)