Merge pull request #226 from louib/fix/generatorCrash

Fixes #199 : Disable buttonGenerate when no classes.
This commit is contained in:
Janek Bevendorff 2017-01-27 03:40:09 +02:00 committed by GitHub
commit 7b2a9f7ea8

View File

@ -132,8 +132,10 @@ void PasswordGeneratorWidget::updatePasswordStrength(const QString& password)
void PasswordGeneratorWidget::generatePassword()
{
QString password = m_generator->generatePassword();
m_ui->editNewPassword->setText(password);
if (m_generator->isValid()) {
QString password = m_generator->generatePassword();
m_ui->editNewPassword->setText(password);
}
}
void PasswordGeneratorWidget::applyPassword()
@ -279,5 +281,11 @@ void PasswordGeneratorWidget::updateGenerator()
m_generator->setCharClasses(classes);
m_generator->setFlags(flags);
if (m_generator->isValid()) {
m_ui->buttonGenerate->setEnabled(true);
} else {
m_ui->buttonGenerate->setEnabled(false);
}
regeneratePassword();
}