[vector] Return nullptr from paint get_funcs for invalid format

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Behdad Esfahbod committed 2026-04-18 10:58:31 -06:00
1 parent dfef3f33ae
commit 57e056a22c
2 files changed
+10 -13

No files matched your search

+8 -12
View File
@@ -121,16 +121,7 @@ static struct hb_vector_draw_pdf_funcs_lazy_loader_t
} static_vector_draw_pdf_funcs;
static inline void free_static_vector_draw_pdf_funcs () { static_vector_draw_pdf_funcs.free_instance (); }
static hb_draw_funcs_t *
hb_vector_draw_funcs_get (hb_vector_format_t format)
{
switch (format)
{
case HB_VECTOR_FORMAT_SVG: return static_vector_draw_svg_funcs.get_unconst ();
case HB_VECTOR_FORMAT_PDF: return static_vector_draw_pdf_funcs.get_unconst ();
case HB_VECTOR_FORMAT_INVALID: default: return nullptr;
}
}
/**
* hb_vector_draw_create_or_fail:
@@ -459,9 +450,14 @@ hb_vector_draw_get_format (const hb_vector_draw_t *draw)
* XSince: REPLACEME
*/
hb_draw_funcs_t *
hb_vector_draw_get_funcs (const hb_vector_draw_t *draw HB_UNUSED)
hb_vector_draw_get_funcs (const hb_vector_draw_t *draw)
{
return hb_vector_draw_funcs_get (draw->format);
switch (draw ? draw->format : HB_VECTOR_FORMAT_INVALID)
{
case HB_VECTOR_FORMAT_SVG: return static_vector_draw_svg_funcs.get_unconst ();
case HB_VECTOR_FORMAT_PDF: return static_vector_draw_pdf_funcs.get_unconst ();
case HB_VECTOR_FORMAT_INVALID: default: return nullptr;
}
}
/**
+2 -1
View File
@@ -520,9 +520,10 @@ hb_vector_paint_get_funcs (const hb_vector_paint_t *paint)
case HB_VECTOR_FORMAT_PDF:
return hb_vector_paint_pdf_funcs_get ();
case HB_VECTOR_FORMAT_SVG:
return hb_vector_paint_svg_funcs_get ();
case HB_VECTOR_FORMAT_INVALID:
default:
return hb_vector_paint_svg_funcs_get ();
return nullptr;
}
}