From 0af0e66586dfddd656932766c0fb9e0132743004 Mon Sep 17 00:00:00 2001 From: Ryooooooga Date: Sat, 21 Aug 2021 18:34:30 +0900 Subject: [PATCH] Fix panic in merge conflict --- pkg/gui/mergeconflicts/find_conflicts.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/gui/mergeconflicts/find_conflicts.go b/pkg/gui/mergeconflicts/find_conflicts.go index e88415959..dc6e99189 100644 --- a/pkg/gui/mergeconflicts/find_conflicts.go +++ b/pkg/gui/mergeconflicts/find_conflicts.go @@ -30,10 +30,14 @@ func findConflicts(content string) []*mergeConflict { case START: newConflict = &mergeConflict{start: i} case MIDDLE: - newConflict.middle = i + if newConflict != nil { + newConflict.middle = i + } case END: - newConflict.end = i - conflicts = append(conflicts, newConflict) + if newConflict != nil { + newConflict.end = i + conflicts = append(conflicts, newConflict) + } // reset value to avoid any possible silent mutations in further iterations newConflict = nil default: