networks: fix for primary connection Closes: #334

Check if there is any primary connection available before accessing this
connections parameter.  Otherwise Plinth will raise an exception because
of non existing object.
This commit is contained in:
Daniel Steglich 2016-01-01 22:48:11 +00:00 committed by Sunil Mohan Adapa
parent 5af50fcbe3
commit 8e4abf282f
No known key found for this signature in database
GPG Key ID: 36C361440C9BC971

View File

@ -102,7 +102,9 @@ def get_status_from_connection(connection):
status['wireless']['ssid'] = setting_wireless.get_ssid().get_data()
primary_connection = nm.Client.new(None).get_primary_connection()
status['primary'] = (primary_connection.get_uuid() == connection.get_uuid())
if primary_connection:
status['primary'] = (primary_connection.get_uuid() ==
connection.get_uuid())
return status