Skip to content

Commit 48aea41

Browse files
committed
Fix sidebar bug
Validate if the description is available in the rawSearchIndex
1 parent 8943653 commit 48aea41

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/librustdoc/html/static/main.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -713,10 +713,12 @@
713713
if (crates[i] == window.currentCrate) {
714714
klass += ' current';
715715
}
716-
var desc = rawSearchIndex[crates[i]].items[0][3];
717-
div.append($('<a>', {'href': '../' + crates[i] + '/index.html',
718-
'title': plainSummaryLine(desc),
719-
'class': klass}).text(crates[i]));
716+
if (rawSearchIndex[crates[i]].items[0]) {
717+
var desc = rawSearchIndex[crates[i]].items[0][3];
718+
div.append($('<a>', {'href': '../' + crates[i] + '/index.html',
719+
'title': plainSummaryLine(desc),
720+
'class': klass}).text(crates[i]));
721+
}
720722
}
721723
sidebar.append(div);
722724
}

0 commit comments

Comments
 (0)