From 2b01ba43cb4ea0994f3a6b074229c4b7be673d25 Mon Sep 17 00:00:00 2001 From: "Bobby R. Ward" Date: Wed, 22 Feb 2012 01:52:50 -0600 Subject: [PATCH] Fix #2035: If auto_add_trackers is empty, it is an array --- .../Label/deluge/plugins/label/data/label.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/deluge/plugins/Label/deluge/plugins/label/data/label.js b/deluge/plugins/Label/deluge/plugins/label/data/label.js index dfbf269f1..375128444 100644 --- a/deluge/plugins/Label/deluge/plugins/label/data/label.js +++ b/deluge/plugins/Label/deluge/plugins/label/data/label.js @@ -1,6 +1,6 @@ /*! * label.js - * + * * Copyright (c) Damien Churchill 2010 * * This program is free software; you can redistribute it and/or modify @@ -36,7 +36,7 @@ Ext.ns('Deluge.ux'); * @extends Ext.Window */ Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, { - + title: _('Add Label'), width: 300, height: 100, @@ -107,7 +107,7 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, { title: _('Label Options'), width: 325, height: 240, - + initComponent: function() { Deluge.ux.LabelOptionsWindow.superclass.initComponent.call(this); this.addButton(_('Cancel'), this.onCancelClick, this); @@ -319,7 +319,7 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, { show: function(label) { Deluge.ux.LabelOptionsWindow.superclass.show.call(this); this.label = label; - this.setTitle(_('Label Options') + ': ' + this.label); + this.setTitle(_('Label Options') + ': ' + this.label); this.tabs.setActiveTab(0); this.getLabelOptions(); }, @@ -330,7 +330,9 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, { onOkClick: function() { var values = this.form.getForm().getFieldValues(); - values['auto_add_trackers'] = values['auto_add_trackers'].split('\n'); + if (values['auto_add_trackers']) { + values['auto_add_trackers'] = values['auto_add_trackers'].split('\n'); + } deluge.client.label.set_options(this.label, values); this.hide(); }, @@ -395,7 +397,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, { }); } }, - + onDisable: function() { deluge.sidebar.un('filtercreate', this.onFilterCreate); deluge.sidebar.un('afterfiltercreate', this.onAfterFilterCreate); @@ -404,7 +406,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, { deluge.menus.torrent.remove(this.tmSep); deluge.menus.torrent.remove(this.tm); }, - + onEnable: function() { this.torrentMenu = new Ext.menu.Menu({ items: [{