[keyboard] Avoid crash with unconfigured keyboards

- If there's no items at all, ->currentItem() can return nullptr,
   so don't dereference that.

Found on FreeBSD.
main
Adriaan de Groot 6 years ago
parent fd5097c466
commit b704933b58

@ -216,12 +216,12 @@ QString
KeyboardPage::prettyStatus() const
{
QString status;
status += tr( "Set keyboard model to %1.<br/>" )
.arg( ui->comboBoxModel->currentText() );
status += tr( "Set keyboard layout to %1/%2." )
.arg( ui->listLayout->currentIndex().data().toString() )
.arg( ui->listVariant->currentItem()->text() );
status += tr( "Set keyboard model to %1.<br/>" ).arg( ui->comboBoxModel->currentText() );
QString layout = ui->listLayout->currentIndex().data().toString();
QString variant = ui->listVariant->currentItem() ? ui->listVariant->currentItem()->text() : QString( "<default>" );
status += tr( "Set keyboard layout to %1/%2." ).arg( layout, variant );
return status;
}

Loading…
Cancel
Save