Changeset

6043:7b093a9b95ea

mod_report_forward: Fix traceback on error message passed to datetime function If archive:get() returns an error, e.g. because it can't find a message with the given ID, it may return e.g. nil, "item-not-found" or similar where the error condition ends up in reported_message_time, which gets passed to util.datetime, which thus ends up doing math to a string or error object.
author Kim Alvefur <zash@zash.se>
date Wed, 06 Nov 2024 22:25:41 +0100
parents 6042:c038b1e01a0e
children 6044:1cfdf76d0a37
files mod_report_forward/mod_report_forward.lua
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_report_forward/mod_report_forward.lua	Wed Nov 06 09:50:48 2024 +0100
+++ b/mod_report_forward/mod_report_forward.lua	Wed Nov 06 22:25:41 2024 +0100
@@ -108,6 +108,7 @@
 		reported_message, reported_message_time, reported_message_with = archive:get(reporter_username, reported_message_el.attr.id);
 		if jid.bare(reported_message_with) ~= event.jid then
 			reported_message = nil;
+			reported_message_time = nil;
 		end
 	end