Bug 1060812 - Stop processing when contact is not found r=Standard8

This commit is contained in:
Adam Roach [:abr]
2014-09-01 15:44:51 -05:00
parent b4c4d69a3c
commit 01336249d7
2 changed files with 26 additions and 21 deletions

View File

@@ -436,7 +436,9 @@ let LoopContactsInternal = Object.freeze({
}
request.onsuccess = event => {
eventEmitter.emit("remove", contact);
if (contact) {
eventEmitter.emit("remove", contact);
}
callback(null, event.target.result);
};
request.onerror = event => callback(event.target.error);
@@ -674,6 +676,7 @@ let LoopContactsInternal = Object.freeze({
if (!contact) {
callback(new Error("Contact with " + kKeyPath + " '" +
guid + "' could not be found"));
return;
}
LoopStorage.getStore(kObjectStoreName, (err, store) => {
@@ -723,6 +726,7 @@ let LoopContactsInternal = Object.freeze({
if (!contact) {
callback(new Error("Contact with " + kKeyPath + " '" +
guid + "' could not be found"));
return;
}
contact.blocked = true;
@@ -749,6 +753,7 @@ let LoopContactsInternal = Object.freeze({
if (!contact) {
callback(new Error("Contact with " + kKeyPath + " '" +
guid + "' could not be found"));
return;
}
contact.blocked = false;