Skip to content

Commit 22ebbd7

Browse files
do not return more matches than available
1 parent 277e165 commit 22ebbd7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/guesser.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ std::vector<int> guesser::guess(std::string in, int count) const {
2222
matches.resize(std::min(100ul, matches.size()));
2323

2424
score_exact_word_matches(in, matches);
25-
matches.resize(count);
25+
matches.resize(std::min(static_cast<std::size_t>(count), matches.size()));
2626

2727
std::vector<int> ret(matches.size());
2828
for (int i = 0; i < matches.size(); ++i) {

0 commit comments

Comments
 (0)