Skip to content

Commit

Permalink
Fix dangling pointer error
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj committed May 23, 2024
1 parent 49ee458 commit 5df535f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sherpa-onnx/csrc/offline-recognizer-paraformer-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ static OfflineRecognitionResult Convert(
mergeable = false;

if (i > 0) {
const uint8_t *p = reinterpret_cast<const uint8_t *>(
sym_table[src.tokens[i - 1]].c_str());
if (p[0] < 0x80) {
const uint8_t p = reinterpret_cast<const uint8_t *>(
sym_table[src.tokens[i - 1]].c_str())[0];
if (p < 0x80) {
// put a space between ascii and non-ascii
text.append(" ");
}
Expand Down

0 comments on commit 5df535f

Please sign in to comment.