forked from osmocom/wireshark
wslua: fail on tree:add(nil)
It is unlikely that tree:add(nil) or tree:add(nil, tvb) represents a valid invocation. Most likely the developer made a mistake and tried something like: local pf_thing = ProtoField.string("some.thing", "Description") some_proto.fields = { pf_thing } ... tree:add(some_proto.fields.thing, tvb()) which should have been: some_proto.fields = { thing = pf_thing } or: tree:add(pf_thing, tvb()) Save the developer some pain and bail out early. Change-Id: I59fc04153f02bb186b47b763676a68bb0271df76 Reviewed-on: https://code.wireshark.org/review/16177 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
cf508f8960
commit
764b147a7c
|
@ -324,6 +324,8 @@ static int TreeItem_add_item_any(lua_State *L, gboolean little_endian) {
|
|||
hfid = proto->hfid;
|
||||
type = FT_PROTOCOL;
|
||||
ett = proto->ett;
|
||||
} else if (lua_isnil(L, 1)) {
|
||||
return luaL_error(L, "first argument to TreeItem:add is nil!");
|
||||
}
|
||||
} else {
|
||||
hfid = field->hfid;
|
||||
|
|
Loading…
Reference in New Issue