Avoid npe because of deleted spinner

master
Jens Lody 5 years ago
parent eb8162c263
commit 6fb7d1ee61
  1. 12
      src/prefs.js

@ -141,7 +141,6 @@ const WeatherPrefsWidget = new GObject.Class({
this.searchMenu = this.Window.get_object("search-menu"); this.searchMenu = this.Window.get_object("search-menu");
this.searchName = this.Window.get_object("search-name"); this.searchName = this.Window.get_object("search-name");
this.searchCombo = this.Window.get_object("search-combo"); this.searchCombo = this.Window.get_object("search-combo");
this.spinner = this.Window.get_object("spinner");
this.searchName.connect("icon-release", Lang.bind(this, this.clearEntry)); this.searchName.connect("icon-release", Lang.bind(this, this.clearEntry));
this.editName.connect("icon-release", Lang.bind(this, this.clearEntry)); this.editName.connect("icon-release", Lang.bind(this, this.clearEntry));
@ -176,13 +175,10 @@ const WeatherPrefsWidget = new GObject.Class({
if (location === "") if (location === "")
return 0; return 0;
let item; let item = new Gtk.MenuItem();
if (this.spinner.get_parent()) { let spinner = new Gtk.Spinner();
item = this.spinner.get_parent(); spinner.start();
}else { item.add(spinner);
item = new Gtk.MenuItem()
item.add(this.spinner);
}
this.searchMenu.append(item); this.searchMenu.append(item);
this.showSearchMenu(); this.showSearchMenu();

Loading…
Cancel
Save