mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-26 05:31:39 +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;
|
continue;
|
||||||
}
|
}
|
||||||
case OP_BNOT: {
|
case OP_BNOT: {
|
||||||
TValue *rb = RB(i);
|
TValue *rb = RKB(i);
|
||||||
if (ttisnumber(rb)) {
|
if (ttisnumber(rb)) {
|
||||||
lua_Number nb = nvalue(rb);
|
lua_Number nb = nvalue(rb);
|
||||||
setnvalue(ra, luai_numnot(nb));
|
setnvalue(ra, luai_numnot(nb));
|
||||||
}
|
}
|
||||||
|
else if (ttisboolean(rb) || ttisnil(rb)) {
|
||||||
|
setbvalue(ra, l_isfalse(rb));
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
Protect(Arith(L, ra, rb, rb, TM_NOT));
|
Protect(Arith(L, ra, rb, rb, TM_NOT));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue