changeset 6491:0a9b516e388e

mod_muc_cache_media: tonumber(nil) is nil
author Stephen Paul Weber <singpolyma@singpolyma.net>
date Tue, 24 Mar 2026 09:13:50 -0500
parents 771944f2a7c7
children b82fceda0abc
files mod_muc_cache_media/mod_muc_cache_media.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_muc_cache_media/mod_muc_cache_media.lua	Tue Mar 24 13:20:51 2026 +0000
+++ b/mod_muc_cache_media/mod_muc_cache_media.lua	Tue Mar 24 09:13:50 2026 -0500
@@ -189,7 +189,7 @@
 				elseif el.name == "fallback" and el.attr.xmlns == "urn:xmpp:fallback:0" and (el.attr["for"] == "jabber:x:oob" or el.attr["for"] == "urn:xmpp:sims:1") then
 					return el:maptags(function(subel)
 						local s, e = string.find(original_body, original_url, 1, true)
-						if s and subel.name == "body" and math.abs(s - tonumber(subel.attr.start)) < 5 then
+						if s and subel.name == "body" and subel.attr.start and math.abs(s - tonumber(subel.attr.start)) < 5 then
 							subel.attr["end"] = tostring((tonumber(subel.attr["end"]) - #original_url) + #data.local_url)
 						end
 						return subel