From 419b25044950ab06a618eca2f3d2d699c1f3501b Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Mon, 10 Jun 2013 10:10:25 +0200 Subject: gateway_id can be nil --- misc/freeswitch/scripts/common/gateway.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'misc') diff --git a/misc/freeswitch/scripts/common/gateway.lua b/misc/freeswitch/scripts/common/gateway.lua index ac38326..0c6ab1c 100644 --- a/misc/freeswitch/scripts/common/gateway.lua +++ b/misc/freeswitch/scripts/common/gateway.lua @@ -34,6 +34,10 @@ end function Gateway.find_by_id(self, id) + if not tonumber(id) then + return nil; + end + local sql_query = 'SELECT `a`.*, `c`.`sip_host` AS `domain`, `c`.`contact` AS `contact_full`, `c`.`network_ip`, `c`.`network_port` \ FROM `gateways` `a` \ LEFT JOIN `gateway_settings` `b` ON `a`.`id` = `b`.`gateway_id` AND `b`.`name` = "inbound_username" \ -- cgit v1.2.3