diff --git a/bytearr.c b/bytearr.c index 78181e4..2126a96 100644 --- a/bytearr.c +++ b/bytearr.c @@ -829,7 +829,7 @@ static int lbytearr_slice( lua_State *L ) handle_scope_except(); Buf *r; - if( start > end || getLength(p) <= start ){ // empty array + if( end < 0 || start > end || (int)getLength(p) <= start ){ // empty array r = createBuf( BYTEARRAY_RESERVE_SIZE, getNativeEndian() ); } else{