Skip to content

Commit 56898ec

Browse files
Prevent JS error when there is no dependency or other crate documented
1 parent 4b9f5cc commit 56898ec

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/librustdoc/html/static/main.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2955,7 +2955,11 @@ function defocusSearchBar() {
29552955
enableSearchInput();
29562956

29572957
var crateSearchDropDown = document.getElementById("crate-search");
2958-
crateSearchDropDown.addEventListener("focus", loadSearch);
2958+
// `crateSearchDropDown` can be null in case there is only crate because in that case, the
2959+
// crate filter dropdown is removed.
2960+
if (crateSearchDropDown) {
2961+
crateSearchDropDown.addEventListener("focus", loadSearch);
2962+
}
29592963
var params = getQueryStringParams();
29602964
if (params.search !== undefined) {
29612965
loadSearch();

0 commit comments

Comments
 (0)