Mercurial > vim
comparison src/terminal.c @ 12363:85fef6805d73 v8.0.1061
patch 8.0.1061: Coverity: no check for NULL command
commit https://github.com/vim/vim/commit/6756c7037f07e1fb54e1b9d8e92567ac388617c4
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Sep 5 23:01:12 2017 +0200
patch 8.0.1061: Coverity: no check for NULL command
Problem: Coverity: no check for NULL command.
Solution: Check for NULL list item.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 05 Sep 2017 23:15:04 +0200 |
parents | 76ab57a79183 |
children | 7ae2b2c84ec5 |
comparison
equal
deleted
inserted
replaced
12362:4ab904b8b1ee | 12363:85fef6805d73 |
---|---|
36 * that buffer, attributes come from the scrollback buffer tl_scrollback. | 36 * that buffer, attributes come from the scrollback buffer tl_scrollback. |
37 * When the buffer is changed it is turned into a normal buffer, the attributes | 37 * When the buffer is changed it is turned into a normal buffer, the attributes |
38 * in tl_scrollback are no longer used. | 38 * in tl_scrollback are no longer used. |
39 * | 39 * |
40 * TODO: | 40 * TODO: |
41 * - ":term NONE" does not work in MS-Windows. | 41 * - ":term NONE" does not work on MS-Windows. |
42 * https://github.com/vim/vim/pull/2056 | |
43 * - Redirecting output does not work on MS-Windows. | |
42 * - implement term_setsize() | 44 * - implement term_setsize() |
43 * - add test for giving error for invalid 'termsize' value. | 45 * - add test for giving error for invalid 'termsize' value. |
44 * - support minimal size when 'termsize' is "rows*cols". | 46 * - support minimal size when 'termsize' is "rows*cols". |
45 * - support minimal size when 'termsize' is empty? | 47 * - support minimal size when 'termsize' is empty? |
46 * - GUI: when using tabs, focus in terminal, click on tab does not work. | 48 * - GUI: when using tabs, focus in terminal, click on tab does not work. |
54 * - when 'encoding' is not utf-8, or the job is using another encoding, setup | 56 * - when 'encoding' is not utf-8, or the job is using another encoding, setup |
55 * conversions. | 57 * conversions. |
56 * - In the GUI use a terminal emulator for :!cmd. | 58 * - In the GUI use a terminal emulator for :!cmd. |
57 * - Copy text in the vterm to the Vim buffer once in a while, so that | 59 * - Copy text in the vterm to the Vim buffer once in a while, so that |
58 * completion works. | 60 * completion works. |
61 * - add an optional limit for the scrollback size. When reaching it remove | |
62 * 10% at the start. | |
59 */ | 63 */ |
60 | 64 |
61 #include "vim.h" | 65 #include "vim.h" |
62 | 66 |
63 #if defined(FEAT_TERMINAL) || defined(PROTO) | 67 #if defined(FEAT_TERMINAL) || defined(PROTO) |
364 else if (STRCMP(cmd, "NONE") == 0) | 368 else if (STRCMP(cmd, "NONE") == 0) |
365 cmd = (char_u *)"pty"; | 369 cmd = (char_u *)"pty"; |
366 } | 370 } |
367 else if (argvar->v_type != VAR_LIST | 371 else if (argvar->v_type != VAR_LIST |
368 || argvar->vval.v_list == NULL | 372 || argvar->vval.v_list == NULL |
369 || argvar->vval.v_list->lv_len < 1) | 373 || argvar->vval.v_list->lv_len < 1 |
374 || (cmd = get_tv_string_chk( | |
375 &argvar->vval.v_list->lv_first->li_tv)) == NULL) | |
370 cmd = (char_u*)""; | 376 cmd = (char_u*)""; |
371 else | |
372 cmd = get_tv_string_chk(&argvar->vval.v_list->lv_first->li_tv); | |
373 | 377 |
374 len = STRLEN(cmd) + 10; | 378 len = STRLEN(cmd) + 10; |
375 p = alloc((int)len); | 379 p = alloc((int)len); |
376 | 380 |
377 for (i = 0; p != NULL; ++i) | 381 for (i = 0; p != NULL; ++i) |