From 929f08419d38aa431b4e26e9940feb3296a83cad Mon Sep 17 00:00:00 2001 From: "Pocze Bence (XC-AS/EDP2-Bp)" Date: Tue, 13 Feb 2024 17:26:44 +0100 Subject: [PATCH] line numbers should never be 0 --- pydiffchecker/line_shift_checker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pydiffchecker/line_shift_checker.py b/pydiffchecker/line_shift_checker.py index c242588..cec872a 100644 --- a/pydiffchecker/line_shift_checker.py +++ b/pydiffchecker/line_shift_checker.py @@ -55,8 +55,8 @@ class LineShiftChecker: for line in process_output: matches = re.search(LineShiftChecker.DIFF_BLOCK_REGEX, line) if matches: - diff_block_src_start = int(matches.group(1)) - diff_block_dst_start = int(matches.group(3)) + diff_block_src_start = max(int(matches.group(1)), 1) # line number should never be 0 + diff_block_dst_start = max(int(matches.group(2)), 1) # line number should never be 0 # fill shifted lines between 2 diff blocks for i in range(0, diff_block_src_start - src_line_index):