Software /
code /
prosody
Diff
core/portmanager.lua @ 12312:8119a58b3a5c
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 22 Feb 2022 13:41:05 +0100 |
parent | 11598:081e550b973a |
child | 12480:7e9ebdc75ce4 |
line wrap: on
line diff
--- 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