From e4054aab79d710bf3dfe7d60592804c52058be96 Mon Sep 17 00:00:00 2001 From: Badlop Date: Wed, 25 Oct 2017 12:58:07 +0200 Subject: [PATCH] Get next record before deleting previous on, in case it's last one (#2069) --- src/mod_mam_mnesia.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod_mam_mnesia.erl b/src/mod_mam_mnesia.erl index f498bc3c7..b672b4107 100644 --- a/src/mod_mam_mnesia.erl +++ b/src/mod_mam_mnesia.erl @@ -91,10 +91,10 @@ delete_old_user_messages(User, TimeStamp, Type) -> ok end end, + NextRecord = mnesia:dirty_next(archive_msg, User), case mnesia:transaction(F) of {atomic, ok} -> - delete_old_user_messages(mnesia:dirty_next(archive_msg, User), - TimeStamp, Type); + delete_old_user_messages(NextRecord, TimeStamp, Type); {aborted, Err} -> ?ERROR_MSG("Cannot delete old MAM messages: ~s", [Err]), Err