fix(snooze): Check if snooze category is defined when creating

This commit is contained in:
Juan Tejada 2016-02-18 10:44:03 -08:00
parent a841417011
commit bb52510c87

View file

@ -25,7 +25,7 @@ export function createSnoozeCategory(accountId, name = SNOOZE_CATEGORY_NAME) {
return TaskQueueStatusStore.waitForPerformRemote(task).then(()=>{
return DatabaseStore.findBy(Category, {clientId: category.clientId})
.then((updatedCat)=> {
if (updatedCat.isSavedRemotely()) {
if (updatedCat && updatedCat.isSavedRemotely()) {
return Promise.resolve(updatedCat)
}
return Promise.reject(new Error('Could not create Snooze category'))