fix: The edge search position out of range, so the finding loop can't break

This commit is contained in:
dreamsourcelabTAI 2023-07-06 16:11:48 +08:00
parent a048fb9e97
commit b9cdb4d76f

View File

@ -1236,8 +1236,8 @@ bool LogicSnapshot::pattern_search_self(int64_t start, int64_t end, int64_t &ind
int count = 0;
bool bEdgeFlag = false;
int64_t to = isNext ? end + 1 : start - 1;
int64_t step = isNext ? 1 : -1;
const int64_t to = isNext ? end + 1 : start - 1;
const int64_t step = isNext ? 1 : -1;
for (auto it = pattern.begin(); it != pattern.end(); it++){
char flag = *(it->second.toStdString().c_str());
@ -1270,6 +1270,13 @@ bool LogicSnapshot::pattern_search_self(int64_t start, int64_t end, int64_t &ind
index += step;
}
if (index < start){
index = start;
}
if (index > end){
index = end;
}
while (index != to)
{
macthed = 0;