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

Loading…
Cancel
Save