Bug 1149880 - Avoid readinglist item races logging unhandled promise exceptions. r=dolske, a=sledru
authorMark Hammond <mhammond@skippinet.com.au>
Tue, 07 Apr 2015 11:43:22 +1000
changeset 258384 115865f14324
parent 258383 0f0c47f90ab6
child 258385 9a763ea8d781
push id4657
push userryanvm@gmail.com
push date2015-04-08 20:55 +0000
treeherdermozilla-beta@bfff2ca94766 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske, sledru
bugs1149880
milestone38.0
Bug 1149880 - Avoid readinglist item races logging unhandled promise exceptions. r=dolske, a=sledru
browser/components/readinglist/sidebar.js
--- a/browser/components/readinglist/sidebar.js
+++ b/browser/components/readinglist/sidebar.js
@@ -462,16 +462,19 @@ let RLSidebar = {
     if (msg.topic != "UpdateActiveItem") {
       return;
     }
 
     if (!msg.url) {
       this.activeItem = null;
     } else {
       ReadingList.itemForURL(msg.url).then(item => {
-        this.activeItem = this.itemNodesById.get(item.id);
+        let node;
+        if (item && (node = this.itemNodesById.get(item.id))) {
+          this.activeItem = node;
+        }
       });
     }
   }
 };
 
 
 addEventListener("DOMContentLoaded", () => RLSidebar.init());