From 7bc4ab0bf7e059365ad22bfcb521e102f8054a74 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 11 Jan 2015 11:04:33 +0100 Subject: [PATCH] gears.object: Assert that arguments have the correct type Signed-off-by: Uli Schlachter --- lib/gears/object.lua.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/gears/object.lua.in b/lib/gears/object.lua.in index 7b1c5171a..31ce91795 100644 --- a/lib/gears/object.lua.in +++ b/lib/gears/object.lua.in @@ -36,6 +36,7 @@ end -- @param name The name of the new signal. function object:add_signal(name) check(self) + assert(type(name) == "string", "name must be a string, got: " .. type(name)) if not self._signals[name] then self._signals[name] = {} end @@ -45,6 +46,7 @@ end -- @param name The name of the signal -- @param func The callback to call when the signal is emitted function object:connect_signal(name, func) + assert(type(func) == "function", "callback must be a function, got: " .. type(func)) local sig = find_signal(self, name, "connect to") sig[func] = func end