Fix unit test crash

This commit is contained in:
Janek Bevendorff 2017-02-24 19:47:03 +01:00
parent 434d0fb1c0
commit 46942413db
No known key found for this signature in database
GPG Key ID: CFEC2F6850BFFA53
2 changed files with 6 additions and 3 deletions

View File

@ -109,6 +109,7 @@ private:
bool appExitCalled;
};
#define KEEPASSXC_MAIN_WINDOW qobject_cast<MainWindow*>(qobject_cast<Application*>(qApp)->mainWindow())
#define KEEPASSXC_MAIN_WINDOW (qobject_cast<Application*>(qApp) ? \
qobject_cast<MainWindow*>(qobject_cast<Application*>(qApp)->mainWindow()) : nullptr)
#endif // KEEPASSX_MAINWINDOW_H

View File

@ -33,8 +33,10 @@ YkChallengeResponseKey::YkChallengeResponseKey(int slot, bool blocking)
: m_slot(slot),
m_blocking(blocking)
{
connect(this, SIGNAL(userInteractionRequired()), KEEPASSXC_MAIN_WINDOW, SLOT(showYubiKeyPopup()));
connect(this, SIGNAL(userConfirmed()), KEEPASSXC_MAIN_WINDOW, SLOT(hideYubiKeyPopup()));
if (KEEPASSXC_MAIN_WINDOW) {
connect(this, SIGNAL(userInteractionRequired()), KEEPASSXC_MAIN_WINDOW, SLOT(showYubiKeyPopup()));
connect(this, SIGNAL(userConfirmed()), KEEPASSXC_MAIN_WINDOW, SLOT(hideYubiKeyPopup()));
}
}
QByteArray YkChallengeResponseKey::rawKey() const