forked from qt-creator/qt-creator
Editor: Check if text codec pointer is valid.
Fixes a crash when collecting codecs for opions page and a unsupported icu is used. Task-number: QTCREATORBUG-16114 Change-Id: I4081748f636602670e37465750862d4da4a14941 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -63,14 +63,15 @@ BehaviorSettingsWidget::BehaviorSettingsWidget(QWidget *parent)
|
|||||||
if (firstNonNegative != mibs.end())
|
if (firstNonNegative != mibs.end())
|
||||||
std::rotate(mibs.begin(), firstNonNegative, mibs.end());
|
std::rotate(mibs.begin(), firstNonNegative, mibs.end());
|
||||||
foreach (int mib, mibs) {
|
foreach (int mib, mibs) {
|
||||||
QTextCodec *codec = QTextCodec::codecForMib(mib);
|
if (QTextCodec *codec = QTextCodec::codecForMib(mib)) {
|
||||||
QString compoundName = QLatin1String(codec->name());
|
QString compoundName = QLatin1String(codec->name());
|
||||||
foreach (const QByteArray &alias, codec->aliases()) {
|
foreach (const QByteArray &alias, codec->aliases()) {
|
||||||
compoundName += QLatin1String(" / ");
|
compoundName += QLatin1String(" / ");
|
||||||
compoundName += QString::fromLatin1(alias);
|
compoundName += QString::fromLatin1(alias);
|
||||||
|
}
|
||||||
|
d->m_ui.encodingBox->addItem(compoundName);
|
||||||
|
d->m_codecs.append(codec);
|
||||||
}
|
}
|
||||||
d->m_ui.encodingBox->addItem(compoundName);
|
|
||||||
d->m_codecs.append(codec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Qt5 doesn't list the system locale (QTBUG-34283), so add it manually
|
// Qt5 doesn't list the system locale (QTBUG-34283), so add it manually
|
||||||
|
Reference in New Issue
Block a user