From b55ecf304416e3ed7a19ac436680b1481073b188 Mon Sep 17 00:00:00 2001 From: Jan Pochyla Date: Fri, 1 Apr 2016 18:10:14 +0200 Subject: [PATCH] clamp tx pagination to 0 --- lib/services/address/history.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/services/address/history.js b/lib/services/address/history.js index 2d1dcd34..88b5c96b 100644 --- a/lib/services/address/history.js +++ b/lib/services/address/history.js @@ -119,8 +119,8 @@ AddressHistory.prototype._paginateWithDetails = function(allTxids, callback) { // Slice the page starting with the most recent var txids; if (self.options.from >= 0 && self.options.to >= 0) { - var fromOffset = totalCount - self.options.from; - var toOffset = totalCount - self.options.to; + var fromOffset = Math.max(0, totalCount - self.options.from); + var toOffset = Math.max(0, totalCount - self.options.to); txids = allTxids.slice(toOffset, fromOffset); } else { txids = allTxids;