Bug 797251 - Marking a task completed with no task selected causes task list to scroll to an invalid row. r+a=philipp
authorMatthew Mecca <matthew.mecca@gmail.com>
Thu, 25 Oct 2012 09:05:04 -0400
changeset 13511 12beb6415d46d8fa879a96bbd819720406572717
parent 13510 7927c8c018cf11197327a6d74cbfdbcdab14b624
child 13512 6d48a6da4e202197fd56e6a5df2955c08bc3604f
push idunknown
push userunknown
push dateunknown
bugs797251
Bug 797251 - Marking a task completed with no task selected causes task list to scroll to an invalid row. r+a=philipp
calendar/base/content/calendar-task-tree.xml
--- a/calendar/base/content/calendar-task-tree.xml
+++ b/calendar/base/content/calendar-task-tree.xml
@@ -453,18 +453,20 @@
               } else if (selItem && selItem.hashId in this.binding.mHash2Index) {
                   // select the previously selected item
                   selIndex = this.binding.mHash2Index[selItem.hashId];
               } else if (selIndex >= this.binding.mTaskArray.length) {
                   // make sure the previously selected index is valid
                   selIndex = this.binding.mTaskArray.length - 1;
               }
 
-              this.tree.view.selection.select(selIndex);
-              this.treebox.ensureRowIsVisible(selIndex);
+              if (selIndex > -1) {
+                  this.tree.view.selection.select(selIndex);
+                  this.treebox.ensureRowIsVisible(selIndex);
+              }
 
               this.treebox.endUpdateBatch();
           },
 
           clear: function tTV_clear() {
               var count = this.binding.mTaskArray.length;
               if (count > 0) {
                   this.binding.mTaskArray = [];