diff --git a/src/tesseract.cc b/src/tesseract.cc index d443687b..b6f3d789 100644 --- a/src/tesseract.cc +++ b/src/tesseract.cc @@ -433,13 +433,6 @@ void TesseractDecoder::decode_to_errors(const std::vector& detections, } prev_ei = ei; - // Create the error chain node for this candidate. - error_chain_arena.emplace_back(); - auto& next_node = error_chain_arena.back(); - next_node.error_index = ei; - next_node.min_detector = min_detector; - next_node.parent_idx = node.error_chain_idx; - next_detectors = detectors; next_detector_cost_tuples[ei].error_blocked = 1; @@ -483,6 +476,13 @@ void TesseractDecoder::decode_to_errors(const std::vector& detections, if (next_cost == INF) continue; + // Create the error chain node for this candidate. + error_chain_arena.emplace_back(); + auto& next_node = error_chain_arena.back(); + next_node.error_index = ei; + next_node.min_detector = min_detector; + next_node.parent_idx = node.error_chain_idx; + pq.push({next_cost, next_num_dets, node.depth + 1, (int64_t)(error_chain_arena.size() - 1)}); ++num_pq_pushed;