File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -2642,6 +2642,20 @@ nv_diffgetput(int put, long count)
26422642 ex_diffgetput (& ea );
26432643}
26442644
2645+ /*
2646+ * Return TRUE if "diff" appears in the list of diff blocks of the current tab.
2647+ */
2648+ static int
2649+ valid_diff (diff_T * diff )
2650+ {
2651+ diff_T * dp ;
2652+
2653+ for (dp = curtab -> tp_first_diff ; dp != NULL ; dp = dp -> df_next )
2654+ if (dp == diff )
2655+ return TRUE;
2656+ return FALSE;
2657+ }
2658+
26452659/*
26462660 * ":diffget"
26472661 * ":diffput"
@@ -2899,9 +2913,9 @@ ex_diffgetput(exarg_T *eap)
28992913 }
29002914 }
29012915
2902- // Adjust marks. This will change the following entries!
29032916 if (added != 0 )
29042917 {
2918+ // Adjust marks. This will change the following entries!
29052919 mark_adjust (lnum , lnum + count - 1 , (long )MAXLNUM , (long )added );
29062920 if (curwin -> w_cursor .lnum >= lnum )
29072921 {
@@ -2923,7 +2937,13 @@ ex_diffgetput(exarg_T *eap)
29232937#endif
29242938 vim_free (dfree );
29252939 }
2926- else
2940+
2941+ // mark_adjust() may have made "dp" invalid. We don't know where
2942+ // to continue then, bail out.
2943+ if (added != 0 && !valid_diff (dp ))
2944+ break ;
2945+
2946+ if (dfree == NULL )
29272947 // mark_adjust() may have changed the count in a wrong way
29282948 dp -> df_count [idx_to ] = new_count ;
29292949
Original file line number Diff line number Diff line change @@ -735,6 +735,8 @@ static char *(features[]) =
735735
736736static int included_patches [] =
737737{ /* Add new patch number below this line */
738+ /**/
739+ 26 ,
738740/**/
739741 25 ,
740742/**/
You can’t perform that action at this time.
0 commit comments