]> source.dussan.org Git - gitblit.git/commitdiff
Ensure that the line counts start at 1
authorJames Moger <james.moger@gitblit.com>
Thu, 22 Mar 2012 11:49:30 +0000 (07:49 -0400)
committerJames Moger <james.moger@gitblit.com>
Thu, 22 Mar 2012 11:49:30 +0000 (07:49 -0400)
src/com/gitblit/LuceneExecutor.java

index b6df254a5bcea82c472d44809da9b4b0030f1fdb..7b6a879fdcf216baab7ac2b983f4234cb9bcd37e 100644 (file)
@@ -1172,7 +1172,7 @@ public class LuceneExecutor implements Runnable {
                                \r
                        if (SearchObjectType.blob  == result.type) {\r
                                // count lines as offset into the content for this fragment\r
-                               int line = StringUtils.countLines(content.substring(0, pos));\r
+                               int line = Math.max(1, StringUtils.countLines(content.substring(0, pos)));\r
                                \r
                                // create fragment tag with line number and language\r
                                String lang = "";\r