Skip to content

Commit e47af0e

Browse files
committed
search: defensive programming
When the search failed fatally for some reason, returning `null` instead of an empty-sized array of results, let's still tell the person viewing the search results that none could be found. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 633ec4b commit e47af0e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

assets/js/application.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,7 @@ var Search = {
284284
$("#search-term").text(term);
285285
this.initializeSearchIndex(async () => {
286286
const results = await Search.pagefind.debouncedSearch(term);
287-
if (results === null) return;
288-
if (results.results.length === 0) {
287+
if (results === null || results.results.length === 0) {
289288
$("#show-results-label").text("No matching pages found.");
290289
return;
291290
}

0 commit comments

Comments
 (0)