clamp tx pagination to 0
This commit is contained in:
parent
766d87192a
commit
b55ecf3044
@ -119,8 +119,8 @@ AddressHistory.prototype._paginateWithDetails = function(allTxids, callback) {
|
|||||||
// Slice the page starting with the most recent
|
// Slice the page starting with the most recent
|
||||||
var txids;
|
var txids;
|
||||||
if (self.options.from >= 0 && self.options.to >= 0) {
|
if (self.options.from >= 0 && self.options.to >= 0) {
|
||||||
var fromOffset = totalCount - self.options.from;
|
var fromOffset = Math.max(0, totalCount - self.options.from);
|
||||||
var toOffset = totalCount - self.options.to;
|
var toOffset = Math.max(0, totalCount - self.options.to);
|
||||||
txids = allTxids.slice(toOffset, fromOffset);
|
txids = allTxids.slice(toOffset, fromOffset);
|
||||||
} else {
|
} else {
|
||||||
txids = allTxids;
|
txids = allTxids;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user