QFontDialog: Fix crash when passing QFont constructed from empty string/stringlist

The standarddialogs example showed a crash when opening the font dialog
due to the empty list.

Amends d8602ce58b.

Pick-to: 6.1
Change-Id: I93191485c72712d9b2d3ea0ae104f5edb9621f0c
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
bb10
Friedemann Kleint 2021-03-29 09:14:55 +02:00
parent e65558c230
commit e49e5d87be
1 changed files with 1 additions and 1 deletions

View File

@ -812,7 +812,7 @@ void QFontDialog::changeEvent(QEvent *e)
void QFontDialog::setCurrentFont(const QFont &font)
{
Q_D(QFontDialog);
d->family = font.families().first();
d->family = font.families().value(0);
d->style = QFontDatabase::styleString(font);
d->size = font.pointSize();
if (d->size == -1) {