aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/grid.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/grid.c')
-rw-r--r--src/nvim/grid.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nvim/grid.c b/src/nvim/grid.c
index 4702e224c6..46f8a59710 100644
--- a/src/nvim/grid.c
+++ b/src/nvim/grid.c
@@ -142,16 +142,16 @@ void grid_putchar(ScreenGrid *grid, int c, int row, int col, int attr)
/// Also return its attribute in *attrp;
void grid_getbytes(ScreenGrid *grid, int row, int col, char *bytes, int *attrp)
{
- size_t off;
-
grid_adjust(&grid, &row, &col);
// safety check
- if (grid->chars != NULL && row < grid->rows && col < grid->cols) {
- off = grid->line_offset[row] + (size_t)col;
- *attrp = grid->attrs[off];
- schar_copy(bytes, grid->chars[off]);
+ if (grid->chars == NULL || row >= grid->rows || col >= grid->cols) {
+ return;
}
+
+ size_t off = grid->line_offset[row] + (size_t)col;
+ *attrp = grid->attrs[off];
+ schar_copy(bytes, grid->chars[off]);
}
/// put string '*text' on the window grid at position 'row' and 'col', with