Commit cf20d046 authored by Eric Bruneton's avatar Eric Bruneton
Browse files

Add an assertion in ByteVector.enlarge().

parent e45e0a04
......@@ -352,6 +352,9 @@ public class ByteVector {
* @param size number of additional bytes that this byte vector should be able to receive.
*/
private void enlarge(final int size) {
if (length > data.length) {
throw new AssertionError("Internal error");
}
int doubleCapacity = 2 * data.length;
int minimalCapacity = length + size;
byte[] newData = new byte[doubleCapacity > minimalCapacity ? doubleCapacity : minimalCapacity];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment