]> source.dussan.org Git - gitblit.git/commitdiff
Fix potential NPE in setting shared permissions
authorJames Moger <james.moger@gitblit.com>
Mon, 23 Sep 2013 13:51:45 +0000 (09:51 -0400)
committerJames Moger <james.moger@gitblit.com>
Mon, 23 Sep 2013 13:51:45 +0000 (09:51 -0400)
src/main/java/com/gitblit/GitBlit.java

index 95da669e119e67fa6549404bad9934b2f63bc4a6..2cebe82b0f624f0feb6e69c124e30b5174a9b50f 100644 (file)
@@ -2534,16 +2534,16 @@ public class GitBlit implements ServletContextListener {
                                }
                        }
 
+                       // Adjust permissions in case we updated the config files
+                       JGitUtils.adjustSharedPerm(new File(r.getDirectory().getAbsolutePath(), "config"),
+                                       getString(Keys.git.createRepositoriesShared, "FALSE"));
+                       JGitUtils.adjustSharedPerm(new File(r.getDirectory().getAbsolutePath(), "HEAD"),
+                                       getString(Keys.git.createRepositoriesShared, "FALSE"));
+
                        // close the repository object
                        r.close();
                }
 
-               // Adjust permissions in case we updated the config files
-               JGitUtils.adjustSharedPerm(new File(r.getDirectory().getAbsolutePath(), "config"),
-                               getString(Keys.git.createRepositoriesShared, "FALSE"));
-               JGitUtils.adjustSharedPerm(new File(r.getDirectory().getAbsolutePath(), "HEAD"),
-                               getString(Keys.git.createRepositoriesShared, "FALSE"));
-
                // update repository cache
                removeFromCachedRepositoryList(repositoryName);
                // model will actually be replaced on next load because config is stale