Skip to content

Commit e407472

Browse files
committed
rustdoc: Check for href when prepending rootPath
Fixes #18354.
1 parent 8a210af commit e407472

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/librustdoc/html/static/main.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -707,8 +707,8 @@
707707
var code = $('<code>').append(structs[j]);
708708
$.each(code.find('a'), function(idx, a) {
709709
var href = $(a).attr('href');
710-
if (!href.startsWith('http')) {
711-
$(a).attr('href', rootPath + $(a).attr('href'));
710+
if (href && !href.startsWith('http')) {
711+
$(a).attr('href', rootPath + href);
712712
}
713713
});
714714
var li = $('<li>').append(code);

0 commit comments

Comments
 (0)