Check if we have a nextSibling first

Test if we have a nextSibling before determining a tagName. This is so
if we have a dir with only subdirs (ie, no files) and the last subdir is
empty, there will be no UL list (which we're looking to maybe remove).
This commit is contained in:
Matt Pass
2013-03-08 14:28:18 +00:00
parent 4aad818888
commit b7aa8bd56c

View File

@@ -59,7 +59,7 @@ if (isset($_GET['location'])) {
newUL = document.createElement("ul");
newUL.style = "display: block";
locNest = targetElem.parentNode.parentNode;
if(locNest.nextSibling.tagName=="UL") {
if(locNest.nextSibling && locNest.nextSibling.tagName=="UL") {
x = locNest.nextSibling;
x.parentNode.removeChild(x);
}