core.portmanager: Fix traceback on attempt to get non-existent service
If there's no such interface:port then `data` is nil and `data.service`
errors.
--- a/core/portmanager.lua Tue Feb 22 14:17:27 2022 +0100
+++ b/core/portmanager.lua Tue Feb 22 13:41:05 2022 +0100
@@ -216,7 +216,9 @@
end
function get_service_at(interface, port)
- local data = active_services:search(nil, interface, port)[1][1];
+ local data = active_services:search(nil, interface, port);
+ if not data or not data[1] or not data[1][1] then return nil, "not-found"; end
+ data = data[1][1];
return data.service, data.server;
end