diff --git a/src/shared/ptyfwd.c b/src/shared/ptyfwd.c index f910f3aaf9..bf775425e7 100644 --- a/src/shared/ptyfwd.c +++ b/src/shared/ptyfwd.c @@ -270,7 +270,9 @@ static int insert_newline_color_erase(PTYForward *f, size_t offset) { _cleanup_free_ char *s = NULL; assert(f); - assert(f->background_color); + + if (!f->background_color) + return 0; /* When we see a newline (ASCII 10) then this sets the background color to the desired one, and erase the rest * of the line with it */ @@ -289,7 +291,9 @@ static int insert_carriage_return_color(PTYForward *f, size_t offset) { _cleanup_free_ char *s = NULL; assert(f); - assert(f->background_color); + + if (!f->background_color) + return 0; /* When we see a carriage return (ASCII 13) this this sets only the background */