mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kdecore: return the value of KGlobal::hasLocale() from KDETranslator::isEmpty() and check it from KDETranslator::translate()
fixes possible crash due to accessing the private KLocale data after destruction Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
7baf0c9d61
commit
e07fc01227
1 changed files with 4 additions and 1 deletions
|
@ -41,12 +41,15 @@ class KDETranslator : public QTranslator
|
||||||
public:
|
public:
|
||||||
QString translate(const char *context, const char *sourceText) const final
|
QString translate(const char *context, const char *sourceText) const final
|
||||||
{
|
{
|
||||||
|
if (isEmpty()) {
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
return KGlobal::locale()->translateQt(context, sourceText);
|
return KGlobal::locale()->translateQt(context, sourceText);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isEmpty() const final
|
bool isEmpty() const final
|
||||||
{
|
{
|
||||||
return false;
|
return !KGlobal::hasLocale();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#endif // QT_NO_TRANSLATION
|
#endif // QT_NO_TRANSLATION
|
||||||
|
|
Loading…
Add table
Reference in a new issue