summaryrefslogtreecommitdiff
path: root/quantum/painter/qp_draw_text.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/painter/qp_draw_text.c')
-rw-r--r--quantum/painter/qp_draw_text.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/quantum/painter/qp_draw_text.c b/quantum/painter/qp_draw_text.c
index a70caac6f4..ff6fc01d11 100644
--- a/quantum/painter/qp_draw_text.c
+++ b/quantum/painter/qp_draw_text.c
@@ -136,7 +136,7 @@ painter_font_handle_t qp_load_font_mem(const void *buffer) {
bool qp_close_font(painter_font_handle_t font) {
qff_font_handle_t *qff_font = (qff_font_handle_t *)font;
- if (!qff_font->validate_ok) {
+ if (!qff_font || !qff_font->validate_ok) {
qp_dprintf("qp_close_font: fail (invalid font)\n");
return false;
}
@@ -380,7 +380,7 @@ static inline bool qp_font_code_point_handler_drawglyph(qff_font_handle_t *qff_f
int16_t qp_textwidth(painter_font_handle_t font, const char *str) {
qff_font_handle_t *qff_font = (qff_font_handle_t *)font;
- if (!qff_font->validate_ok) {
+ if (!qff_font || !qff_font->validate_ok) {
qp_dprintf("qp_textwidth: fail (invalid font)\n");
return false;
}
@@ -406,13 +406,13 @@ int16_t qp_drawtext(painter_device_t device, uint16_t x, uint16_t y, painter_fon
int16_t qp_drawtext_recolor(painter_device_t device, uint16_t x, uint16_t y, painter_font_handle_t font, const char *str, uint8_t hue_fg, uint8_t sat_fg, uint8_t val_fg, uint8_t hue_bg, uint8_t sat_bg, uint8_t val_bg) {
qp_dprintf("qp_drawtext_recolor: entry\n");
painter_driver_t *driver = (painter_driver_t *)device;
- if (!driver->validate_ok) {
+ if (!driver || !driver->validate_ok) {
qp_dprintf("qp_drawtext_recolor: fail (validation_ok == false)\n");
return 0;
}
qff_font_handle_t *qff_font = (qff_font_handle_t *)font;
- if (!qff_font->validate_ok) {
+ if (!qff_font || !qff_font->validate_ok) {
qp_dprintf("qp_drawtext_recolor: fail (invalid font)\n");
return false;
}