diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index ca6d944195777..4f8488cca682b 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -713,10 +713,12 @@
if (crates[i] == window.currentCrate) {
klass += ' current';
}
- var desc = rawSearchIndex[crates[i]].items[0][3];
- div.append($('', {'href': '../' + crates[i] + '/index.html',
- 'title': plainSummaryLine(desc),
- 'class': klass}).text(crates[i]));
+ if (rawSearchIndex[crates[i]].items[0]) {
+ var desc = rawSearchIndex[crates[i]].items[0][3];
+ div.append($('', {'href': '../' + crates[i] + '/index.html',
+ 'title': plainSummaryLine(desc),
+ 'class': klass}).text(crates[i]));
+ }
}
sidebar.append(div);
}