Remove useless null pointer checks

Cache can't be null, since it's a member of an extant object.

Change-Id: Id98140e1c2f0426cabbefffd157ed3cdd62a8bba
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Thiago Macieira 2019-01-30 20:16:42 -08:00
parent 9b8493314d
commit a5da01c044

View File

@ -544,11 +544,9 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name)
#if !QT_CONFIG(icu)
QTextCodecCache *cache = &globalData->codecCache;
QTextCodec *codec;
if (cache) {
codec = cache->value(name);
if (codec)
return codec;
}
codec = cache->value(name);
if (codec)
return codec;
for (TextCodecListConstIt it = globalData->allCodecs.constBegin(), cend = globalData->allCodecs.constEnd(); it != cend; ++it) {
QTextCodec *cursor = *it;
@ -560,8 +558,7 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name)
QList<QByteArray> aliases = cursor->aliases();
for (ByteArrayListConstIt ait = aliases.constBegin(), acend = aliases.constEnd(); ait != acend; ++ait) {
if (qTextCodecNameMatch(*ait, name)) {
if (cache)
cache->insert(name, cursor);
cache->insert(name, cursor);
return cursor;
}
}