Skip to content

Commit

Permalink
Merge pull request #196 from quexten/fix/check-ui-values
Browse files Browse the repository at this point in the history
Fix ui crash when data is empty
  • Loading branch information
quexten authored May 4, 2024
2 parents 8f14fce + 7e35380 commit 6d7498c
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions gui/src/gui/quickaccess.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def key_press(self, event, keyval, keycode, state):

# totp code
if keyval == Gdk.KEY_t or keyval == Gdk.KEY_T:
if self.filtered_logins[self.selected_index]["totp"] == "":
return
if auto_type_combo:
self.run_autotype(totp.totp(self.filtered_logins[self.selected_index]["totp"]))
if copy_combo:
Expand Down Expand Up @@ -154,15 +156,34 @@ def render_list(self):

for i in self.filtered_logins:
action_row = Adw.ActionRow()
action_row.set_title(i["name"])
action_row.set_subtitle(i["username"])
if "name" in i:
action_row.set_title(i["name"])
else:
action_row.set_title("[no name]")
if "username" in i:
action_row.set_subtitle(i["username"])
action_row.username = i["username"]
else:
action_row.set_subtitle("[no username]")
action_row.username = "[no username]"
if "password" in i:
action_row.password = i["password"]
else:
action_row.password = "[no password]"
if "uri" in i:
action_row.uri = i["uri"]
else:
action_row.uri = "[no uri]"
if "uuid" in i:
action_row.uuid = i["uuid"]
else:
action_row.uuid = "[no uuid]"
if "totp" in i:
action_row.totp = i["totp"]
else:
action_row.totp = ""
action_row.set_icon_name("dialog-password")
action_row.set_activatable(True)
action_row.password = i["password"]
action_row.username = i["username"]
action_row.uuid = i["uuid"]
action_row.uri = i["uri"]
action_row.totp = i["totp"]
self.results_list.append(action_row)

# select the nth item
Expand Down

0 comments on commit 6d7498c

Please sign in to comment.