Adds guard against empty search strings to Find in Article
This commit is contained in:
parent
96671df667
commit
46ce824b98
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue