Merge pull request #1447 from jhollinger/develop

Bugfixes to getChatHistory API method
pull/1448/head
John McLear 2013-02-04 07:07:47 -08:00
commit a5fb1e33de
1 changed files with 4 additions and 4 deletions

View File

@ -325,17 +325,17 @@ exports.getChatHistory = function(padID, start, end, callback)
if(!start || !end) if(!start || !end)
{ {
start = 0; 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")); callback(new customError("start is higher or equal to the current chatHead","apierror"));
return; 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; return;
} }