]> source.dussan.org Git - gitblit.git/commitdiff
Fix potential NPE in git commit search
authorJames Moger <james.moger@gitblit.com>
Mon, 23 Sep 2013 13:52:10 +0000 (09:52 -0400)
committerJames Moger <james.moger@gitblit.com>
Mon, 23 Sep 2013 13:52:10 +0000 (09:52 -0400)
src/main/java/com/gitblit/utils/JGitUtils.java

index cf6ec26dc42a2a91e0a8fa4f431a24fbd8b3b3b9..3c1173ce0a67fced98a887a27fa5b4ae5f624b6f 100644 (file)
@@ -1342,14 +1342,17 @@ public class JGitUtils {
         */\r
        public static List<RevCommit> searchRevlogs(Repository repository, String objectId,\r
                        String value, final com.gitblit.Constants.SearchType type, int offset, int maxCount) {\r
-               final String lcValue = value.toLowerCase();\r
                List<RevCommit> list = new ArrayList<RevCommit>();\r
+               if (StringUtils.isEmpty(value)) {\r
+                       return list;\r
+               }\r
                if (maxCount == 0) {\r
                        return list;\r
                }\r
                if (!hasCommits(repository)) {\r
                        return list;\r
                }\r
+               final String lcValue = value.toLowerCase();\r
                try {\r
                        // resolve branch\r
                        ObjectId branchObject;\r