Skip to content

Commit

Permalink
Corrected a bug in bytes.sub()
Browse files Browse the repository at this point in the history
  • Loading branch information
L1L1 committed Feb 9, 2014
1 parent d2cbaac commit cdb7a57
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua_bytes.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ static int subr_bytes_sub(lua_State *L)

ret = bytestring_new(bs->width);

if (bytestring_substr(ret,start,end-start+1,bs)!=BYTESTRING_OK)
if (start>end || bytestring_substr(ret,start,end-start+1,bs)!=BYTESTRING_OK)
{
bytestring_free(ret);
lua_pushnil(L);
Expand Down

0 comments on commit cdb7a57

Please sign in to comment.