Software /
code /
prosody
Changeset
13078:6da83deb8d7f 0.12
util.error: Fix error on conversion of invalid error stanza, fix #1805
Error stanzas should have an <error> element, but if you pass a
stanza without one to util.error.from_stanza() it triggers an attempt to
index a nil value, which this patch avoids.
In the conditional, it should be safe to assume error_tag is non-nil
since condition can't have those values then.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 19 Apr 2023 11:32:53 +0200 |
parents | 13077:de42a93a7c8d |
children | 13079:e7a5e5a0dc02 13090:3cea237f9d1d |
files | util/error.lua |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/util/error.lua Thu Apr 06 17:09:03 2023 +0200 +++ b/util/error.lua Wed Apr 19 11:32:53 2023 +0200 @@ -141,7 +141,7 @@ local error_tag = stanza:get_child("error"); context = context or {}; context.stanza = stanza; - context.by = error_tag.attr.by or stanza.attr.from; + context.by = error_tag and error_tag.attr.by or stanza.attr.from; local uri; if condition == "gone" or condition == "redirect" then