summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-07-07 22:39:36 -0400
committerIan Moffett <ian@osmora.org>2024-07-07 22:39:36 -0400
commita768baa745c3f4804b7965419956adb5b7d6ef87 (patch)
tree80c57f003e5c1f0851e6f61411c4dfec6b067890
parent8d1e5ffe355b0e0bbb60fa88d306304a1746bc8c (diff)
kernel: cons: Ensure fb_mem isn't NULL
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--sys/dev/cons/cons.c5
1 files changed, 4 insertions, 1 deletions
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);