Skip to content

Commit

Permalink
fix: LocationWidget: crash if lang is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
sithlord48 committed Aug 4, 2024
1 parent b4a6eda commit 287b589
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/widgets/data/LocationViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ void LocationViewer::setRegion(const QString &newRegion)
QString LocationViewer::translate(QString text)
{
QString lang;

if (region.contains(QStringLiteral("BASCUS-94163")) || region.contains(QStringLiteral("BESCES-00867")))
lang = QStringLiteral("en");
else if (region.contains(QStringLiteral("BESCES-00868")))
Expand All @@ -477,9 +478,13 @@ QString LocationViewer::translate(QString text)
lang = QStringLiteral("es");
else if (region.contains(QStringLiteral("BISLPS-00700")) || region.contains(QStringLiteral("BISLPS-01057")))
lang = QStringLiteral("ja");

if(lang.isNull())
return text;

if(!ff7tkInfo::translations().value(lang))
return text;

QString newText = ff7tkInfo::translations().value(lang)->translate("FF7Location", text.toLatin1());
if (newText.isEmpty())
return text;
Expand Down

0 comments on commit 287b589

Please sign in to comment.