From 65a4b5e8284636bc94524fab91c0bb69fb3e6488 Mon Sep 17 00:00:00 2001 From: anod221 Date: Fri, 31 Aug 2018 11:16:37 +0800 Subject: [PATCH] update slice test code. --- bytearr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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{