From 66a8db8f81165ea3ab5cdab0f7ca9dd3e6c20d1a Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Thu, 28 Mar 2013 16:42:12 -0400
Subject: [PATCH] Fixed internal error on folder history links (issue 192)

---
 releases.moxie                                            |    1 +
 src/main/java/com/gitblit/wicket/panels/HistoryPanel.java |    6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/releases.moxie b/releases.moxie
index f51af67..61e2153 100644
--- a/releases.moxie
+++ b/releases.moxie
@@ -8,6 +8,7 @@
     fixes:
      - Could not reset settings with $ or { characters through Gitblit Manager because they are not properly escaped
 	 - Fix NPE when getting user's fork without repository list caching (issue 182)
+	 - Fix internal error on folder history links (issue 192)
 
     additions: 
 	 - Option to force client-side basic authentication instead of form-based authentication if web.authenticateViewPages=true (issue 222)
diff --git a/src/main/java/com/gitblit/wicket/panels/HistoryPanel.java b/src/main/java/com/gitblit/wicket/panels/HistoryPanel.java
index e587863..4d27589 100644
--- a/src/main/java/com/gitblit/wicket/panels/HistoryPanel.java
+++ b/src/main/java/com/gitblit/wicket/panels/HistoryPanel.java
@@ -109,13 +109,13 @@
 		}
 		
 		final boolean isTree = matchingPath == null ? true : matchingPath.isTree();
-		final boolean isSubmodule = matchingPath == null ? true : matchingPath.isSubmodule();
+		final boolean isSubmodule = matchingPath == null ? false : matchingPath.isSubmodule();
 
 		// submodule
-		SubmoduleModel submodule = getSubmodule(submodules, repositoryName, matchingPath.path);
 		final String submodulePath;
 		final boolean hasSubmodule; 
-		if (submodule != null) {
+		if (isSubmodule) {
+			SubmoduleModel submodule = getSubmodule(submodules, repositoryName, matchingPath == null ? null : matchingPath.path);
 			submodulePath = submodule.gitblitPath;
 			hasSubmodule = submodule.hasSubmodule;
 		} else {

--
Gitblit v1.9.1