From 718421a46db198aa60ad4b783fb1dbf89b5c85a7 Mon Sep 17 00:00:00 2001 From: Jordan Hollinger Date: Mon, 4 Feb 2013 00:57:51 -0500 Subject: [PATCH] Bugfixes to getChatHistory API method --- src/node/db/API.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/node/db/API.js b/src/node/db/API.js index f99a43afd..07141fec2 100644 --- a/src/node/db/API.js +++ b/src/node/db/API.js @@ -325,17 +325,17 @@ exports.getChatHistory = function(padID, start, end, callback) if(!start || !end) { start = 0; - end = pad.chatHead - 1; + end = pad.chatHead; } - if(start >= chatHead) + if(start >= chatHead && chatHead > 0) { callback(new customError("start is higher or equal to the current chatHead","apierror")); return; } - if(end >= chatHead) + if(end > chatHead) { - callback(new customError("end is higher or equal to the current chatHead","apierror")); + callback(new customError("end is higher than the current chatHead","apierror")); return; }