patch 9.1.1023: Coverity complains about dereferencing NULL pointer
Problem: Coverity complains about dereferencing NULL pointer
Solution: Verify curdiff is not null before dereferencing it
closes: #16437
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/diff.c b/src/diff.c
index 7e56641..c348894 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -2062,8 +2062,11 @@
else
{
(*linesfiller) = 0;
- ch_virtual_lines = get_max_diff_length(curdif);
- isfiller = (curdif->df_count[toidx] ? FALSE : TRUE);
+ if (curdif)
+ {
+ ch_virtual_lines = get_max_diff_length(curdif);
+ isfiller = (curdif->df_count[toidx] ? FALSE : TRUE);
+ }
if (isfiller)
{
while (curdif && curdif->df_next &&