From a29515f72ea5e6c5ec50baac86928fb8db747d3f Mon Sep 17 00:00:00 2001
From: codeboss <2422523675@qq.com>
Date: Mon, 24 Feb 2025 15:12:14 +0800
Subject: [PATCH] fix-nullptr
---
WsNovelParser/WsNovelParser.vcxproj.user | 2 +-
libSyntax/libsyntax.cpp | 9 +++++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/WsNovelParser/WsNovelParser.vcxproj.user b/WsNovelParser/WsNovelParser.vcxproj.user
index 0de2f02..aa22114 100644
--- a/WsNovelParser/WsNovelParser.vcxproj.user
+++ b/WsNovelParser/WsNovelParser.vcxproj.user
@@ -6,7 +6,7 @@
--path "D:\Projects\Cpp\WsNovelParser\x64\test_file" --dest E:\
- --path "D:\CustomNovels\科学+修仙+创造世界" --dest E:\
+ --path "D:\Projects\Cpp\WsNovelParser\x64\test_file" --dest E:\
WindowsLocalDebugger
$(SolutionDir)$(Platform)\$(Configuration)\
diff --git a/libSyntax/libsyntax.cpp b/libSyntax/libsyntax.cpp
index 3333631..05a7fcf 100644
--- a/libSyntax/libsyntax.cpp
+++ b/libSyntax/libsyntax.cpp
@@ -339,12 +339,13 @@ void MatchCursor::enterExprs() {
}
void lib_syntax::MatchCursor::logExprsError(std::shared_ptr t, const QString& msg) {
- if(!this->_total_errors.contains(t->position()))
- this->_total_errors[t->position()] = QStringList();
+ auto pos_key = t?t->position():0;
+ if(!this->_total_errors.contains(pos_key))
+ this->_total_errors[pos_key] = QStringList();
- auto exists = this->_total_errors[t->position()];
+ auto exists = this->_total_errors[pos_key];
exists.append(msg);
- this->_total_errors[t->position()] = exists;
+ this->_total_errors[pos_key] = exists;
this->_exprs_errors.last()->addError(t, msg);