clang/"Argument with 'nonnull' attribute passed null" #10739

Problem:  In screen.c grid_char_needs_redraw clang warns
          that grid->chars could be NULL

Solution: Suggested by bfredl. Add explicit check
          grid->chars != NULL in grid_put_linebuf
          similar to grid_puts_len
This commit is contained in:
Ihor Antonov 2019-08-11 03:47:49 -04:00 committed by Justin M. Keyes
parent c190415dc2
commit e5d388f23a
1 changed files with 6 additions and 0 deletions

View File

@ -4374,6 +4374,12 @@ static void grid_put_linebuf(ScreenGrid *grid, int row, int coloff, int endcol,
screen_adjust_grid(&grid, &row, &coloff);
// Safety check. Avoids clang warnings down the call stack.
if (grid->chars == NULL || row >= grid->Rows || col >= grid->Columns) {
DLOG("invalid state, skipped");
return;
}
off_from = 0;
off_to = grid->line_offset[row] + coloff;
max_off_from = linebuf_size;