From 3d0747957ea8ad1d416aca4c175b0f523d1c5a08 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 31 Jul 2015 07:41:57 -0400
Subject: [PATCH] Fix some javascript errors in rare situations (#1490441)

---
 program/js/list.js |    4 ++++
 CHANGELOG          |    1 +
 program/js/app.js  |    2 +-
 3 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 166e9ee..c458648 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -32,6 +32,7 @@
 - Fix so imap folder attribute comparisons are case-insensitive (#1490466)
 - Fix bug where new messages weren't added to the list in search mode
 - Fix wrong positioning of message list header on page scroll in Webkit browsers (#1490035)
+- Fix some javascript errors in rare situations (#1490441)
 
 RELEASE 1.1.2
 -------------
diff --git a/program/js/app.js b/program/js/app.js
index b5d6ccd..f0e9149 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -8128,7 +8128,7 @@
   // get the IMP mailbox of the message with the given UID
   this.get_message_mailbox = function(uid)
   {
-    var msg = this.env.messages ? this.env.messages[uid] : {};
+    var msg = (this.env.messages && uid ? this.env.messages[uid] : null) || {};
     return msg.mbox || this.env.mailbox;
   };
 
diff --git a/program/js/list.js b/program/js/list.js
index 5a420b1..0dc700e 100644
--- a/program/js/list.js
+++ b/program/js/list.js
@@ -565,6 +565,10 @@
  */
 click_row: function(e, id)
 {
+  // sanity check
+  if (!id || !this.rows[id])
+    return false;
+
   // don't do anything (another action processed before)
   if (!this.is_event_target(e))
     return true;

--
Gitblit v1.9.1