cope better with no-result cases
authorMike Shaver <shaver@mozilla.org>
Thu, 03 Feb 2011 08:43:23 +0000
changeset 33 a7b6a81983f785a5e3ac5f4bf14e46b4e55c1c5a
parent 32 33b9573c57570ac41e9d7e1fe8f84014a92fe6af
child 34 7d87f021cc6423e904c71b9ee3de804398f7fd56
push id25
push usershaver@mozilla.com
push dateSun, 06 Feb 2011 05:21:47 +0000
cope better with no-result cases
server/websocket.js
--- a/server/websocket.js
+++ b/server/websocket.js
@@ -36,17 +36,17 @@ function runSearch(message, cb)
 
     var redisStartTime = Date.now();
     redisConn.sinter(words.map(function (v) { return "word:" + v;}), receiveMatchingBugs);
 
     function receiveMatchingBugs(err, results)
     {
         if (err) { util.log("ERR (redis): " + err); return undefined; }
         
-        if (!results)
+        if (!results || results.length == 0)
             return sendResponse();
 
         var MAX_RESULTS = 100;
         var limit;
         if (results.length > MAX_RESULTS) {
             start = results.length - MAX_RESULTS;
             resultmsg.hasMore = true;
             resultmsg.totalResults = results.length;