Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix in getSyncResponse - don't hang when the client passes in zero id…

…entities
  • Loading branch information...
commit 708c0a2677f074e7a59c71a5f2b947f32714d5b5 1 parent d75055a
@lloyd lloyd authored
Showing with 13 additions and 9 deletions.
  1. +13 −9 browserid/lib/db.js
View
22 browserid/lib/db.js
@@ -329,16 +329,20 @@ exports.getSyncResponse = function(email, identities, cb) {
// #3 -- yes, this is sub-optimal in terms of performance. when we
// move away from public keys this will be unnec.
- var checked = 0;
- keysToCheck.forEach(function(e) {
- emailHasPubkey(e, identities[e], function(v) {
- checked++;
- if (!v) respBody.key_refresh.push(e);
- if (checked === keysToCheck.length) {
- cb(undefined, respBody);
- }
+ if (keysToCheck.length) {
+ var checked = 0;
+ keysToCheck.forEach(function(e) {
+ emailHasPubkey(e, identities[e], function(v) {
+ checked++;
+ if (!v) respBody.key_refresh.push(e);
+ if (checked === keysToCheck.length) {
+ cb(undefined, respBody);
+ }
+ });
});
- });
+ } else {
+ cb(undefined, respBody);
+ }
}
});
});

0 comments on commit 708c0a2

Please sign in to comment.
Something went wrong with that request. Please try again.