From b328bc8cb8a972b29f4d7a21bf0f2426f3b75a32 Mon Sep 17 00:00:00 2001 From: JunjieBai Date: Tue, 12 Sep 2023 15:41:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(index):=E4=BF=AE=E6=94=B9=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=A7=A3=E6=9E=90=E9=80=BB=E8=BE=91=20?= =?UTF-8?q?=E4=B8=80=E4=BA=9B=E6=A0=BC=E5=BC=8F=E6=9C=89=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E7=9A=84=E6=96=87=E4=BB=B6=E5=8F=AF=E8=83=BD=E4=BC=9A=E8=A2=AB?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E6=88=90=E4=B9=B1=E7=A0=81=EF=BC=8C=E5=9B=A0?= =?UTF-8?q?=E6=AD=A4=E6=A3=80=E6=B5=8B=E5=88=B0=E7=BC=96=E7=A0=81=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E6=9C=89=E9=97=AE=E9=A2=98=E5=88=99=E8=B7=B3=E8=BF=87?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libsearch/file-utils.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libsearch/file-utils.cpp b/libsearch/file-utils.cpp index e7c0d99..4a9a45b 100644 --- a/libsearch/file-utils.cpp +++ b/libsearch/file-utils.cpp @@ -610,8 +610,10 @@ void FileUtils::getTxtContent(const QString &path, QString &textcontent) { uchardet_data_end(chardet); const char *codec = uchardet_get_charset(chardet); - if(QTextCodec::codecForName(codec) == 0) + if(QTextCodec::codecForName(codec) == nullptr) { qWarning() << "Unsupported Text encoding format" << path << QString::fromLocal8Bit(codec); + return; + } QTextStream stream(encodedString, QIODevice::ReadOnly); stream.setCodec(codec);