diff --git a/deluge/ui/web/js/deluge-all/ConnectionManager.js b/deluge/ui/web/js/deluge-all/ConnectionManager.js index 1e807be52..075ef57b5 100644 --- a/deluge/ui/web/js/deluge-all/ConnectionManager.js +++ b/deluge/ui/web/js/deluge-all/ConnectionManager.js @@ -268,7 +268,9 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { record.set('status', host[1]) record.set('version', host[2]) record.commit(); - if (this.list.getSelectedRecords()[0] == record) this.updateButtons(record); + var selected = this.list.getSelectedRecords()[0] + if (!selected) return; + if (selected == record) this.updateButtons(record); }, // private diff --git a/deluge/ui/web/js/deluge-all/EditTrackersWindow.js b/deluge/ui/web/js/deluge-all/EditTrackersWindow.js index 0f64529b2..7e16997fa 100644 --- a/deluge/ui/web/js/deluge-all/EditTrackersWindow.js +++ b/deluge/ui/web/js/deluge-all/EditTrackersWindow.js @@ -134,7 +134,9 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, { }, onEditClick: function() { - this.editWindow.show(this.list.getSelectedRecords()[0]); + var selected = this.list.getSelectedRecords()[0]; + if (!selected) return; + this.editWindow.show(selected); }, onHide: function() { @@ -164,7 +166,9 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, { onRemoveClick: function() { // Remove from the grid - this.list.getStore().remove(this.list.getSelectedRecords()[0]); + var selected = this.list.getSelectedRecords()[0]; + if (!selected) return; + this.list.getStore().remove(selected); }, onRequestComplete: function(status) { diff --git a/deluge/ui/web/js/deluge-all/FilterPanel.js b/deluge/ui/web/js/deluge-all/FilterPanel.js index b3e5d37e0..a7d651d83 100644 --- a/deluge/ui/web/js/deluge-all/FilterPanel.js +++ b/deluge/ui/web/js/deluge-all/FilterPanel.js @@ -77,6 +77,7 @@ Deluge.FilterPanel = Ext.extend(Ext.Panel, { if (!this.list.getSelectionCount()) return; var state = this.list.getSelectedRecords()[0]; + if (!state) return; if (state.id == 'All') return; return state.id; }, @@ -137,9 +138,10 @@ Deluge.FilterPanel = Ext.extend(Ext.Panel, { store.each(function(record) { if (filters[record.id]) return; - var r = this.list.getSelectedRecords()[0]; store.remove(record); - if (r.id == record.id) { + var selected = this.list.getSelectedRecords()[0]; + if (!selected) return; + if (selected.id == record.id) { this.list.select(0); } }, this); diff --git a/deluge/ui/web/js/deluge-all/add/AddWindow.js b/deluge/ui/web/js/deluge-all/add/AddWindow.js index 2996ace5e..ad230515f 100644 --- a/deluge/ui/web/js/deluge-all/add/AddWindow.js +++ b/deluge/ui/web/js/deluge-all/add/AddWindow.js @@ -188,6 +188,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { onRemove: function() { if (!this.list.getSelectionCount()) return; var torrent = this.list.getSelectedRecords()[0]; + if (!torrent) return; this.list.getStore().remove(torrent); this.optionsPanel.clear();