terminal: check for errors when initializing text renderer
We need to check for errors, otherwise, the text-renderer may be invalid and we will never be able to render on it. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
4e9ad1b915
commit
ac8cc08f41
@ -191,7 +191,11 @@ static int add_display(struct kmscon_terminal *term, struct uterm_display *disp)
|
||||
goto err_font;
|
||||
}
|
||||
|
||||
kmscon_text_set(scr->txt, scr->font, scr->screen);
|
||||
ret = kmscon_text_set(scr->txt, scr->font, scr->screen);
|
||||
if (ret) {
|
||||
log_error("cannot set text-renderer parameters");
|
||||
goto err_text;
|
||||
}
|
||||
|
||||
cols = kmscon_text_get_cols(scr->txt);
|
||||
rows = kmscon_text_get_rows(scr->txt);
|
||||
@ -204,6 +208,8 @@ static int add_display(struct kmscon_terminal *term, struct uterm_display *disp)
|
||||
uterm_display_ref(scr->disp);
|
||||
return 0;
|
||||
|
||||
err_text:
|
||||
kmscon_text_unref(scr->txt);
|
||||
err_font:
|
||||
kmscon_font_unref(scr->font);
|
||||
err_screen:
|
||||
|
Loading…
x
Reference in New Issue
Block a user