@@ -39,28 +39,32 @@ function createDirEntry(elem, parent, fullPath, currentFile, hasFoundFile) {
3939 children . className = "children" ;
4040 var folders = document . createElement ( "div" ) ;
4141 folders . className = "folders" ;
42- for ( var i = 0 ; i < elem . dirs . length ; ++ i ) {
43- if ( createDirEntry ( elem . dirs [ i ] , folders , fullPath , currentFile ,
44- hasFoundFile ) === true ) {
45- addClass ( name , "expand" ) ;
46- hasFoundFile = true ;
42+ if ( elem . dirs ) {
43+ for ( var i = 0 ; i < elem . dirs . length ; ++ i ) {
44+ if ( createDirEntry ( elem . dirs [ i ] , folders , fullPath , currentFile ,
45+ hasFoundFile ) === true ) {
46+ addClass ( name , "expand" ) ;
47+ hasFoundFile = true ;
48+ }
4749 }
4850 }
4951 children . appendChild ( folders ) ;
5052
5153 var files = document . createElement ( "div" ) ;
5254 files . className = "files" ;
53- for ( i = 0 ; i < elem . files . length ; ++ i ) {
54- var file = document . createElement ( "a" ) ;
55- file . innerText = elem . files [ i ] ;
56- file . href = window . rootPath + "src/" + fullPath + elem . files [ i ] + ".html" ;
57- if ( hasFoundFile === false &&
58- currentFile === fullPath + elem . files [ i ] ) {
59- file . className = "selected" ;
60- addClass ( name , "expand" ) ;
61- hasFoundFile = true ;
55+ if ( elem . files ) {
56+ for ( i = 0 ; i < elem . files . length ; ++ i ) {
57+ var file = document . createElement ( "a" ) ;
58+ file . innerText = elem . files [ i ] ;
59+ file . href = window . rootPath + "src/" + fullPath + elem . files [ i ] + ".html" ;
60+ if ( hasFoundFile === false &&
61+ currentFile === fullPath + elem . files [ i ] ) {
62+ file . className = "selected" ;
63+ addClass ( name , "expand" ) ;
64+ hasFoundFile = true ;
65+ }
66+ files . appendChild ( file ) ;
6267 }
63- files . appendChild ( file ) ;
6468 }
6569 search . fullPath = fullPath ;
6670 children . appendChild ( files ) ;
0 commit comments