From a768baa745c3f4804b7965419956adb5b7d6ef87 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sun, 7 Jul 2024 22:39:36 -0400 Subject: kernel: cons: Ensure fb_mem isn't NULL Signed-off-by: Ian Moffett --- sys/dev/cons/cons.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/dev/cons/cons.c b/sys/dev/cons/cons.c index 76f71a7..4c83c62 100644 --- a/sys/dev/cons/cons.c +++ b/sys/dev/cons/cons.c @@ -51,8 +51,11 @@ cons_render_char(struct cons_screen *scr, char c, uint32_t x, uint32_t y) size_t idx; const uint8_t *glyph; - glyph = &CONS_FONT[(int)c*16]; + if (scr->fb_mem == NULL) { + return; + } + glyph = &CONS_FONT[(int)c*16]; for (uint32_t cy = 0; cy < FONT_HEIGHT; ++cy) { for (uint32_t cx = 0; cx < FONT_WIDTH; ++cx) { idx = fbdev_get_index(&scr->fbdev, x+FONT_WIDTH-cx, y+cy); -- cgit v1.2.3