diff options
author | Christian Aistleitner <christian@quelltextlich.at> | 2013-03-25 01:42:23 +0100 |
---|---|---|
committer | Christian Aistleitner <christian@quelltextlich.at> | 2013-03-25 01:42:23 +0100 |
commit | ce3f4bd24c330e0cace6a31567e1516dfaa66234 (patch) | |
tree | 884ba35f7bfff72f4e49037baeed903bee05ff5a /src | |
parent | c7acc2e1fa86102bb87e715c8fe4e336329fbcc6 (diff) | |
download | gitblit-ce3f4bd24c330e0cace6a31567e1516dfaa66234.tar.gz gitblit-ce3f4bd24c330e0cace6a31567e1516dfaa66234.zip |
Fix NPE when getting user's fork without repository list caching (issue-182)
When a user does not have a fork of a project, getProjectModel returns
null. So we guard against null before dereferencing the returned
project.
Diffstat (limited to 'src')
-rw-r--r-- | src/com/gitblit/GitBlit.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/com/gitblit/GitBlit.java b/src/com/gitblit/GitBlit.java index 6bf75d75..bb9b988f 100644 --- a/src/com/gitblit/GitBlit.java +++ b/src/com/gitblit/GitBlit.java @@ -1827,6 +1827,9 @@ public class GitBlit implements ServletContextListener { } else {
// not caching
ProjectModel project = getProjectModel(userProject);
+ if (project == null) {
+ return null;
+ }
for (String repository : project.repositories) {
if (repository.startsWith(userProject)) {
RepositoryModel model = getRepositoryModel(repository);
|