xdl_merge(): fix a segmentation fault when refining conflicts
[gitweb.git] / xdiff / xmerge.c
index 352207e5168135f3c6306968f03a8d191d6ac2bb..294450b89916180ab603d566e7d3f281773a3b92 100644 (file)
@@ -190,6 +190,10 @@ static int xdl_refine_conflicts(xdfenv_t *xe1, xdfenv_t *xe2, xdmerge_t *m,
                if (m->mode)
                        continue;
 
+               /* no sense refining a conflict when one side is empty */
+               if (m->chg1 == 0 || m->chg2 == 0)
+                       continue;
+
                /*
                 * This probably does not work outside git, since
                 * we have a very simple mmfile structure.