aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/shell.c
diff options
context:
space:
mode:
authorckelsel <ckelsel@hotmail.com>2017-07-30 09:10:22 +0800
committerckelsel <ckelsel@hotmail.com>2017-07-30 09:10:22 +0800
commit7c7039767aa4d715aea997721b0d759b308a43d4 (patch)
treeec7c704982a8fabb676700b218f066eb6c84cc0e /src/nvim/os/shell.c
parent973bc2b7e0ef1ca33764410ba0a22fc57bd42366 (diff)
parent743993eb553302a461ee0ef9cffa57f93c10c955 (diff)
downloadrneovim-7c7039767aa4d715aea997721b0d759b308a43d4.tar.gz
rneovim-7c7039767aa4d715aea997721b0d759b308a43d4.tar.bz2
rneovim-7c7039767aa4d715aea997721b0d759b308a43d4.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/nvim/os/shell.c')
-rw-r--r--src/nvim/os/shell.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c
index 9d80a43718..32e9a70e57 100644
--- a/src/nvim/os/shell.c
+++ b/src/nvim/os/shell.c
@@ -447,7 +447,7 @@ static void out_data_append_to_screen(char *output, size_t remaining,
size_t off = 0;
int last_row = (int)Rows - 1;
- while (off < remaining) {
+ while (output != NULL && off < remaining) {
// Found end of line?
if (output[off] == NL) {
// Can we start a new line or do we need to continue the last one?
@@ -473,7 +473,7 @@ static void out_data_append_to_screen(char *output, size_t remaining,
off++;
}
- if (remaining) {
+ if (output != NULL && remaining) {
if (last_col == 0) {
screen_del_lines(0, 0, 1, (int)Rows, NULL);
}
@@ -496,12 +496,8 @@ static void out_data_cb(Stream *stream, RBuffer *buf, size_t count, void *data,
size_t cnt;
char *ptr = rbuffer_read_ptr(buf, &cnt);
- if (ptr == NULL || cnt == 0) {
- // Nothing to read;
- return;
- }
-
- if (out_data_decide_throttle(cnt)) { // Skip output above a threshold.
+ if (ptr != NULL && cnt > 0
+ && out_data_decide_throttle(cnt)) { // Skip output above a threshold.
// Save the skipped output. If it is the final chunk, we display it later.
out_data_ring(ptr, cnt);
} else {