diff options
author | Kim Alvefur <zash@zash.se> | 2023-04-19 11:32:53 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2023-04-19 11:32:53 +0200 |
commit | 57c37716145d1383e861c390c4953f41e81dfdb3 (patch) | |
tree | cf83d6527691274b0de9a1c7cbb26cebc7ae3df4 | |
parent | 506ee45da2853e66bf20b0d9a2c3cbee22c4b55d (diff) | |
download | prosody-57c37716145d1383e861c390c4953f41e81dfdb3.tar.gz prosody-57c37716145d1383e861c390c4953f41e81dfdb3.zip |
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.
-rw-r--r-- | util/error.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/util/error.lua b/util/error.lua index 326c01f8..b83f81e5 100644 --- a/util/error.lua +++ b/util/error.lua @@ -141,7 +141,7 @@ local function from_stanza(stanza, context, source) 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 |