Fix occasional inline code lookup issues:

This commit addresses a problem where ChatGPT code snippets might not
accurately be identified within a patch set's codebase. The issue
typically arises when the patch set includes deletions at the beginning
of files.

Change-Id: I00fbde248ac5d218f13eea880f88740eeabfc900
Signed-off-by: Patrizio <patrizio.gelosi@amarulasolutions.com>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/patch/diff/FileDiffProcessed.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/patch/diff/FileDiffProcessed.java
index 1ea641f..258503d 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/patch/diff/FileDiffProcessed.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/mode/common/client/patch/diff/FileDiffProcessed.java
@@ -101,7 +101,8 @@
         }
         // If the lines modified in the PatchSet are deleted, they are mapped in charToLineMapItem to current lineNum
         else {
-            charToLineMapItem.put(content.length(), lineNum);
+            int startingPosition = charToLineMapItem.isEmpty() ? 0 : content.length();
+            charToLineMapItem.put(startingPosition, lineNum);
         }
 
         if (config.getGptFullFileReview() || !diffType.equals("ab")) {