mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
test(unit/eval/typval_spec): don't dereference NULL last_msg_hist
If last_msg_hist is NULL, check_emsg will cause the running test process to SIGSEGV from trying to access the msg member.
This commit is contained in:
parent
7f8c1e53a6
commit
1ffd20a26e
@ -101,12 +101,13 @@ local function check_emsg(f, msg)
|
|||||||
saved_last_msg_hist = nil
|
saved_last_msg_hist = nil
|
||||||
end
|
end
|
||||||
local ret = {f()}
|
local ret = {f()}
|
||||||
|
local last_msg = lib.last_msg_hist ~= nil and ffi.string(lib.last_msg_hist.msg) or nil
|
||||||
if msg ~= nil then
|
if msg ~= nil then
|
||||||
eq(msg, ffi.string(lib.last_msg_hist.msg))
|
eq(msg, last_msg)
|
||||||
neq(saved_last_msg_hist, lib.last_msg_hist)
|
neq(saved_last_msg_hist, lib.last_msg_hist)
|
||||||
else
|
else
|
||||||
if saved_last_msg_hist ~= lib.last_msg_hist then
|
if saved_last_msg_hist ~= lib.last_msg_hist then
|
||||||
eq(nil, ffi.string(lib.last_msg_hist.msg))
|
eq(nil, last_msg)
|
||||||
else
|
else
|
||||||
eq(saved_last_msg_hist, lib.last_msg_hist)
|
eq(saved_last_msg_hist, lib.last_msg_hist)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user