mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-27 22:52:41 +00:00
Lua: fix crash with unary not (~) on boolean constant/nil and let it work on boolean/nil values in general
This commit is contained in:
parent
85c5fa9527
commit
42c72b7b0d
1 changed files with 4 additions and 1 deletions
|
@ -541,11 +541,14 @@ void luaV_execute (lua_State *L, int nexeccalls) {
|
|||
continue;
|
||||
}
|
||||
case OP_BNOT: {
|
||||
TValue *rb = RB(i);
|
||||
TValue *rb = RKB(i);
|
||||
if (ttisnumber(rb)) {
|
||||
lua_Number nb = nvalue(rb);
|
||||
setnvalue(ra, luai_numnot(nb));
|
||||
}
|
||||
else if (ttisboolean(rb) || ttisnil(rb)) {
|
||||
setbvalue(ra, l_isfalse(rb));
|
||||
}
|
||||
else {
|
||||
Protect(Arith(L, ra, rb, rb, TM_NOT));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue