Adds guard against empty search strings to Find in Article

This commit is contained in:
Brian Sanders 2020-05-14 07:20:40 -04:00
parent 96671df667
commit 46ce824b98
2 changed files with 6 additions and 0 deletions

View File

@ -709,6 +709,7 @@ internal struct FindInArticleState: Codable {
}
extension WebViewController {
func searchText(_ searchText: String, completionHandler: @escaping (FindInArticleState) -> Void) {
guard let json = try? JSONEncoder().encode(FindInArticleOptions(text: searchText)) else {
return

View File

@ -429,6 +429,11 @@ updateFind = withEncodedArg(options => {
// TODO Introduce slight delay, cap the number of results, and report results asynchronously
let newFindState;
if (!options || !options.text) {
clearHighlightRects();
return
}
try {
newFindState = new FindState(options);
} catch (err) {