Software /
code /
prosody
Changeset
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 |
parents | 12311:bc30e1b9ad89 |
children | 12313:469e4453ed01 |
files | core/portmanager.lua |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
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