修复空story崩溃问题

This commit is contained in:
codeboss 2025-05-17 22:40:43 +08:00
parent 5a4369d7cc
commit c58b022b21
2 changed files with 18 additions and 15 deletions

View File

@ -3,7 +3,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerWorkingDirectory>$(SolutionDir)$(Platform)\$(Configuration)\</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>--path "E:\novel-set" --dest F:\novelout</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>--path "E:\CustomNovels\科学+修仙+创造世界" --dest F:\novelout</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerCommandArguments>--path "D:\Projects\Cpp\WsNovelParser\x64\test_file" --dest E:\</LocalDebuggerCommandArguments>

View File

@ -393,12 +393,15 @@ std::shared_ptr<FragmentNode> FragmentLayerCheck::_sets_fill(std::shared_ptr<con
auto ptr = _sets_fill(nis);
if (ptr) list << ptr;
}
for (auto nitr = ++list.begin(); nitr != list.end(); nitr++)
(*(nitr-1))->appendNext(*nitr);
if (list.size())
if (list.size()) {
for (auto nitr = ++list.begin(); nitr != list.end(); nitr++) {
auto prev = *(nitr - 1);
prev->appendNext(*nitr);
}
this->_story_start << list.first();
}
}
break;
default:
for (auto nis : node->children())
@ -427,7 +430,6 @@ void FragmentLayerCheck::node_relayer(std::shared_ptr<FragmentNode> node, int cu
for (auto nis : node->referNodes())
node_relayer(nis, curr_num + 1);
}
qDebug() << node->bind()->element()->signature() << node->layerNumber();
}
@ -455,6 +457,7 @@ void FragmentLayerCheck::story_layer_check(std::shared_ptr<const ast_gen::Elemen
std::copy_if(fragms_list.begin(), fragms_list.end(), std::back_inserter(real_elms),
[](std::shared_ptr<const ast_gen::ElementAccess> ins) { return ins->element()->typeMark() == (int) NovelNode::FragmentSlice; });
if (real_elms.size())
for (auto curr = ++real_elms.begin(); curr != real_elms.end(); ++curr) {
auto prev_it = curr - 1;
auto curr_it = curr;