Qt: Fix crash when players column is visible

This commit is contained in:
Stenzek 2024-10-14 12:47:09 +10:00
parent 11c212260c
commit 2604df5917
No known key found for this signature in database
1 changed files with 3 additions and 1 deletions

View File

@ -447,7 +447,9 @@ QVariant GameListModel::data(const QModelIndex& index, int role, const GameList:
case Column_Players: case Column_Players:
{ {
if (ge->dbentry->min_players == ge->dbentry->max_players) if (!ge->dbentry || ge->dbentry->min_players == 0)
return QString();
else if (ge->dbentry->min_players == ge->dbentry->max_players)
return QStringLiteral("%1").arg(ge->dbentry->min_players); return QStringLiteral("%1").arg(ge->dbentry->min_players);
else else
return QStringLiteral("%1-%2").arg(ge->dbentry->min_players).arg(ge->dbentry->max_players); return QStringLiteral("%1-%2").arg(ge->dbentry->min_players).arg(ge->dbentry->max_players);