aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2016-06-28 00:15:33 +0200
committerMichael Mann <mmann78@netscape.net>2016-07-04 16:26:38 +0000
commit764b147a7c604e7b718a48770ce010bf2ab6e5ea (patch)
treed134d88f5621c9a224e48b54c2cbf6a974c28d3a /epan/wslua
parentcf508f8960df48c5829a9108f087511c7352547b (diff)
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>
Diffstat (limited to 'epan/wslua')
-rw-r--r--epan/wslua/wslua_tree.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/epan/wslua/wslua_tree.c b/epan/wslua/wslua_tree.c
index 1ca9794a55..716efec384 100644
--- a/epan/wslua/wslua_tree.c
+++ b/epan/wslua/wslua_tree.c
@@ -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;