From af6b6c8e7cd5ba13a7175db890b21970a1ff82d4 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 4 Jul 2022 10:56:46 +0200 Subject: QStringConverter: Do not use std::optional::value() value() can potentially throw an exception. We know that it doesn't in this case, but the compiler doesn't know. And our code checker doesn't know either and generates lots of false positives. Also, without the exception propagation code the resulting binary is probably smaller. Coverity-Id: 386110 Coverity-Id: 384314 Coverity-Id: 383835 Coverity-Id: 383784 Pick-to: 6.4 Change-Id: Icdacf8e003fd3a6ac8fd260ed335239a59de3295 Reviewed-by: Giuseppe D'Angelo Reviewed-by: Thiago Macieira --- src/corelib/text/qstringconverter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/text') diff --git a/src/corelib/text/qstringconverter.cpp b/src/corelib/text/qstringconverter.cpp index 38a434f353..4c94de029e 100644 --- a/src/corelib/text/qstringconverter.cpp +++ b/src/corelib/text/qstringconverter.cpp @@ -1924,7 +1924,7 @@ QStringConverter::QStringConverter(const char *name, Flags f) { auto e = encodingForName(name); if (e) - iface = encodingInterfaces + int(e.value()); + iface = encodingInterfaces + int(*e); #if QT_CONFIG(icu) else iface = QStringConverterICU::make_icu_converter(&state, name); -- cgit v1.2.3