aboutsummaryrefslogtreecommitdiff
path: root/src/node_flat.erl
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2021-06-08 16:42:38 +0200
committerBadlop <badlop@process-one.net>2021-06-08 19:00:39 +0200
commit4520d5f3c12771cb6bbd800c2bab9b2480f3ae91 (patch)
treea6e1fad498fe2216e0e9cc7bef53dcf3d94d63a2 /src/node_flat.erl
parentGet explicitely rebar3 3.15 binary that works with Erlang 21.3 (diff)
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
Diffstat (limited to 'src/node_flat.erl')
-rw-r--r--src/node_flat.erl2
1 files changed, 2 insertions, 0 deletions
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)};