Skip to content

Commit

Permalink
Merge pull request #3393 from eighttails/fix_zero_division
Browse files Browse the repository at this point in the history
Fix division by zero during CJK training.
  • Loading branch information
egorpugin authored Apr 11, 2021
2 parents 0401b94 + 8a8204e commit 423f00c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/textord/cjkpitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class LocalCorrelation {
vote += values_[i].vote;
}

return rc / vote;
return vote == 0 ? 0.0f : rc / vote;
}

private:
Expand Down

0 comments on commit 423f00c

Please sign in to comment.