Skip to content

Commit

Permalink
fix: WifiAccessPoint.psk: return None if couldn't get secrets (ha…
Browse files Browse the repository at this point in the history
…ndle `GLib.GError`)
  • Loading branch information
linkfrg committed Feb 3, 2025
1 parent c555dcd commit 1883aca
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ignis/services/network/access_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,11 @@ def psk(self) -> str | None:
``None`` if there is no a saved psk for this access point.
"""
for conn in self._connections:
secrets: dict = conn.get_secrets("802-11-wireless-security").unpack()
try:
secrets: dict = conn.get_secrets("802-11-wireless-security").unpack()
except GLib.GError: # if couldn't get secrets
return None

return secrets.get("802-11-wireless-security", {}).get("psk", None)
else:
return None
Expand Down

0 comments on commit 1883aca

Please sign in to comment.