Skip to content

Commit

Permalink
Fix plug crashes (#314)
Browse files Browse the repository at this point in the history
* Check array has elements

* Don't show_all everywhere
  • Loading branch information
davidmhewitt authored Sep 7, 2021
1 parent f5bfa68 commit 1a94957
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 6 deletions.
4 changes: 0 additions & 4 deletions src/MainView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ public class Network.MainView : Gtk.Paned {

update_interfaces_names ();
update_all ();
show_all ();
}

private void update_all () {
Expand All @@ -221,7 +220,6 @@ public class Network.MainView : Gtk.Paned {
device_list.add_iface_to_list (widget_interface);

update_networking_state ();
show_all ();
}

private void remove_interface (Widgets.Page widget_interface) {
Expand All @@ -240,8 +238,6 @@ public class Network.MainView : Gtk.Paned {
}

widget_interface.destroy ();

show_all ();
}

private void add_connection (NM.RemoteConnection connection) {
Expand Down
1 change: 0 additions & 1 deletion src/Widgets/DeviceList.vala
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ namespace Network.Widgets {
}

add (item);
show_all ();
}

public void remove_iface_from_list (Widgets.Page iface) {
Expand Down
2 changes: 1 addition & 1 deletion src/Widgets/Page.vala
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ namespace Network.Widgets {
} else if (status_switch.active && device.get_state () == NM.DeviceState.DISCONNECTED) {
var connection = NM.SimpleConnection.new ();
var remote_array = device.get_available_connections ();
if (remote_array != null) {
if (remote_array != null && remote_array.length > 0) {
connection.set_path (remote_array.get (0).get_path ());
unowned NetworkManager network_manager = NetworkManager.get_default ();
network_manager.client.activate_connection_async.begin (connection, device, null, null, null);
Expand Down

0 comments on commit 1a94957

Please sign in to comment.