Skip to content

Commit 0c0859e

Browse files
committed
Avoid crash
1 parent 83ddd88 commit 0c0859e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cli.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,10 @@ void processNearestCmd()
697697
string best_c_d = best_jaccard_substr(text[1], text[0]);
698698
vector<string> tokens;
699699
boost::split(tokens, best_c_d, boost::is_any_of(" "));
700+
if (tokens.size() < 2) {
701+
error("Both clipboards must have at least 2 characters.");
702+
return;
703+
}
700704
info("Nearest Jaccard distance is " + tokens[1] + " with substring " + tokens[0] + ".");
701705
} else {
702706
error("Text 1 or 2 is not set.");

0 commit comments

Comments
 (0)