From 4520d5f3c12771cb6bbd800c2bab9b2480f3ae91 Mon Sep 17 00:00:00 2001 From: Badlop Date: Tue, 8 Jun 2021 16:42:38 +0200 Subject: [PATCH] Support for simple limiting the number of items in PubSub with RSM (#3618) This fixes crash in Example 1 from "2.1 Limiting the Number of Items": https://xmpp.org/extensions/xep-0059.html#limit --- src/node_flat.erl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/node_flat.erl b/src/node_flat.erl index c51cebe87..1fd860ec2 100644 --- a/src/node_flat.erl +++ b/src/node_flat.erl @@ -750,6 +750,8 @@ get_items(Nidx, _From, #rsm_set{max = Max, index = IncIndex, end, {Offset, ItemsPage} = case {IncIndex, Before, After} of + {undefined, undefined, undefined} -> + {0, lists:sublist(RItems, Limit)}; {I, undefined, undefined} -> SubList = lists:nthtail(I, RItems), {I, lists:sublist(SubList, Limit)};