From: nicm Date: Tue, 25 Oct 2022 09:04:49 +0000 (+0000) Subject: Do not fire redraw callback if NULL. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a50debc46510e3f17a480b8b1950f5ce4c6afe24;p=openbsd Do not fire redraw callback if NULL. --- diff --git a/usr.bin/tmux/screen-write.c b/usr.bin/tmux/screen-write.c index 5fcb8e00af7..3880577806a 100644 --- a/usr.bin/tmux/screen-write.c +++ b/usr.bin/tmux/screen-write.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen-write.c,v 1.209 2022/08/02 11:09:26 nicm Exp $ */ +/* $OpenBSD: screen-write.c,v 1.210 2022/10/25 09:04:49 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1505,8 +1505,10 @@ screen_write_fullredraw(struct screen_write_ctx *ctx) screen_write_collect_flush(ctx, 0, __func__); - screen_write_initctx(ctx, &ttyctx, 1); - ttyctx.redraw_cb(&ttyctx); + if (ttyctx.redraw_cb != NULL) { + screen_write_initctx(ctx, &ttyctx, 1); + ttyctx.redraw_cb(&ttyctx); + } } /* Trim collected items. */ @@ -2127,8 +2129,10 @@ screen_write_alternateon(struct screen_write_ctx *ctx, struct grid_cell *gc, screen_write_collect_flush(ctx, 0, __func__); screen_alternate_on(ctx->s, gc, cursor); - screen_write_initctx(ctx, &ttyctx, 1); - ttyctx.redraw_cb(&ttyctx); + if (ttyctx.redraw_cb != NULL) { + screen_write_initctx(ctx, &ttyctx, 1); + ttyctx.redraw_cb(&ttyctx); + } } /* Turn alternate screen off. */ @@ -2145,6 +2149,8 @@ screen_write_alternateoff(struct screen_write_ctx *ctx, struct grid_cell *gc, screen_write_collect_flush(ctx, 0, __func__); screen_alternate_off(ctx->s, gc, cursor); - screen_write_initctx(ctx, &ttyctx, 1); - ttyctx.redraw_cb(&ttyctx); + if (ttyctx.redraw_cb != NULL) { + screen_write_initctx(ctx, &ttyctx, 1); + ttyctx.redraw_cb(&ttyctx); + } }