diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/nvim/api/buffer.c | 10 | 
1 files changed, 10 insertions, 0 deletions
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index 8ff24b877e..3acebd6df3 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -45,6 +45,11 @@ Integer nvim_buf_line_count(Buffer buffer, Error *err)      return 0;    } +  // return sentinel value if the buffer isn't loaded +  if (buf->b_ml.ml_mfp == NULL) { +    return 0; +  } +    return buf->b_ml.ml_line_count;  } @@ -221,6 +226,11 @@ ArrayOf(String) nvim_buf_get_lines(uint64_t channel_id,      return rv;    } +  // return sentinel value if the buffer isn't loaded +  if (buf->b_ml.ml_mfp == NULL) { +    return rv; +  } +    bool oob = false;    start = normalize_index(buf, start, &oob);    end = normalize_index(buf, end, &oob);  | 
