]> granicus.if.org Git - vim/commitdiff
patch 8.0.0968: crash when switching terminal modes v8.0.0968
authorBram Moolenaar <Bram@vim.org>
Sat, 19 Aug 2017 19:23:05 +0000 (21:23 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 19 Aug 2017 19:23:05 +0000 (21:23 +0200)
Problem:    Crash when switching terminal modes. (Nikolai Pavlov)
Solution:   Check that there are scrollback lines.

src/terminal.c
src/version.c

index 6b401beee85993621f3223aa165dfa76ff3a512b..bb2dba90cd9ff0dbbad7ea24446226db5c8ad7f2 100644 (file)
@@ -1037,14 +1037,13 @@ term_enter_job_mode()
 
     /* Remove the terminal contents from the scrollback and the buffer. */
     gap = &term->tl_scrollback;
-    while (curbuf->b_ml.ml_line_count > term->tl_scrollback_scrolled)
+    while (curbuf->b_ml.ml_line_count > term->tl_scrollback_scrolled
+                                                           && gap->ga_len > 0)
     {
        ml_delete(curbuf->b_ml.ml_line_count, FALSE);
        line = (sb_line_T *)gap->ga_data + gap->ga_len - 1;
        vim_free(line->sb_cells);
        --gap->ga_len;
-       if (gap->ga_len == 0)
-           break;
     }
     check_cursor();
 
index 28dffea666b5f1a333a4c750f55f7037340ea819..2f9012745108635ff3d67d194a99951669d1f8eb 100644 (file)
@@ -769,6 +769,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    968,
 /**/
     967,
 /**/