From b7aa8bd56cd8110f65f32c419e6f00ef61449e71 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 8 Mar 2013 14:28:18 +0000 Subject: [PATCH] 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). --- lib/get-branch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/get-branch.php b/lib/get-branch.php index 793431d..8f7b7d8 100644 --- a/lib/get-branch.php +++ b/lib/get-branch.php @@ -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); }