From c2833a3fd84e8a7f1361cb3c5c03652dead5b337 Mon Sep 17 00:00:00 2001 From: James Moger Date: Thu, 22 Mar 2012 07:49:30 -0400 Subject: [PATCH] Ensure that the line counts start at 1 --- src/com/gitblit/LuceneExecutor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/gitblit/LuceneExecutor.java b/src/com/gitblit/LuceneExecutor.java index b6df254a..7b6a879f 100644 --- a/src/com/gitblit/LuceneExecutor.java +++ b/src/com/gitblit/LuceneExecutor.java @@ -1172,7 +1172,7 @@ public class LuceneExecutor implements Runnable { if (SearchObjectType.blob == result.type) { // count lines as offset into the content for this fragment - int line = StringUtils.countLines(content.substring(0, pos)); + int line = Math.max(1, StringUtils.countLines(content.substring(0, pos))); // create fragment tag with line number and language String lang = ""; -- 2.39.5