summaryrefslogtreecommitdiff
path: root/src/plop.erl
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2014-11-18 16:45:18 +0100
committerMagnus Ahltorp <map@kth.se>2014-11-19 05:03:19 +0100
commit41412486d1b128057e453ac94c675a83a2f3e1b4 (patch)
treeea039de453dda0921567a6a58585429c7878ef91 /src/plop.erl
parent4c4f904ee1a7fe2b61137532de3668ba5ad3a6d8 (diff)
Move db size check from db.erl to plop.erl to allow reads past db size.
Diffstat (limited to 'src/plop.erl')
-rw-r--r--src/plop.erl3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plop.erl b/src/plop.erl
index 6501105..161faf8 100644
--- a/src/plop.erl
+++ b/src/plop.erl
@@ -217,8 +217,9 @@ handle_call(stop, _From, Plop) ->
{stop, normal, stopped, Plop};
handle_call({get, {index, Start, End}}, _From, Plop) ->
+ EndBound = min(End, db:size() - 1),
{reply, lists:map(fun (E) -> fill_in_entry(E) end,
- db:get_by_indices(Start, End, {sorted, false})),
+ db:get_by_indices(Start, EndBound, {sorted, false})),
Plop};
handle_call({get, {hash, EntryHash}}, _From, Plop) ->