From 17326dc3ec1eb7e494a40c8491063dd70c6c771e Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Mon, 5 Apr 2021 22:15:28 -0400 Subject: [PATCH] Auto-Type: Resolve username/password when copying to clipboard * Fix #3882 * Add nullptr checks as well --- src/autotype/AutoTypeSelectDialog.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/autotype/AutoTypeSelectDialog.cpp b/src/autotype/AutoTypeSelectDialog.cpp index 9ff230cda..752d23e3d 100644 --- a/src/autotype/AutoTypeSelectDialog.cpp +++ b/src/autotype/AutoTypeSelectDialog.cpp @@ -281,16 +281,25 @@ void AutoTypeSelectDialog::buildActionMenu() }); connect(copyUsernameAction, &QAction::triggered, this, [&] { - clipboard()->setText(m_ui->view->currentMatch().first->username()); - reject(); + auto entry = m_ui->view->currentMatch().first; + if (entry) { + clipboard()->setText(entry->resolvePlaceholder(entry->username())); + reject(); + } }); connect(copyPasswordAction, &QAction::triggered, this, [&] { - clipboard()->setText(m_ui->view->currentMatch().first->password()); - reject(); + auto entry = m_ui->view->currentMatch().first; + if (entry) { + clipboard()->setText(entry->resolvePlaceholder(entry->password())); + reject(); + } }); connect(copyTotpAction, &QAction::triggered, this, [&] { - clipboard()->setText(m_ui->view->currentMatch().first->totp()); - reject(); + auto entry = m_ui->view->currentMatch().first; + if (entry) { + clipboard()->setText(entry->totp()); + reject(); + } }); }