From: James Moger Date: Sun, 13 Jan 2013 22:28:05 +0000 (-0500) Subject: Null checks when generating a fork network (issue-187) X-Git-Tag: v1.2.1~5 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9727511ad07db2c332f164fe399108768457bdae;p=gitblit.git Null checks when generating a fork network (issue-187) --- diff --git a/docs/04_releases.mkd b/docs/04_releases.mkd index 3d17a9b2..af702f2c 100644 --- a/docs/04_releases.mkd +++ b/docs/04_releases.mkd @@ -7,6 +7,7 @@ #### fixes - Fixed nullpointer on recursively calculating folder sizes when there is a named pipe or symlink in the hierarchy +- Added nullchecking when concurrently forking a repository and trying to display it's fork network (issue-187) - Fixed bug where permission changes were not visible in the web ui to a logged-in user until the user logged-out and then logged back in again (issue-186) - Fixed nullpointer on creating a repository with mixed case (issue 185) - Fixed nullpointer when using web.allowForking = true && git.cacheRepositoryList = false (issue 182) diff --git a/src/com/gitblit/GitBlit.java b/src/com/gitblit/GitBlit.java index f417b3eb..e3ecebd8 100644 --- a/src/com/gitblit/GitBlit.java +++ b/src/com/gitblit/GitBlit.java @@ -1872,11 +1872,16 @@ public class GitBlit implements ServletContextListener { private ForkModel getForkModelFromCache(String repository) { RepositoryModel model = repositoryListCache.get(repository.toLowerCase()); + if (model == null) { + return null; + } ForkModel fork = new ForkModel(model); if (!ArrayUtils.isEmpty(model.forks)) { for (String aFork : model.forks) { ForkModel fm = getForkModelFromCache(aFork); - fork.forks.add(fm); + if (fm != null) { + fork.forks.add(fm); + } } } return fork; @@ -1884,11 +1889,16 @@ public class GitBlit implements ServletContextListener { private ForkModel getForkModel(String repository) { RepositoryModel model = getRepositoryModel(repository.toLowerCase()); + if (model == null) { + return null; + } ForkModel fork = new ForkModel(model); if (!ArrayUtils.isEmpty(model.forks)) { for (String aFork : model.forks) { ForkModel fm = getForkModel(aFork); - fork.forks.add(fm); + if (fm != null) { + fork.forks.add(fm); + } } } return fork;