1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

lhp: assert if NULL css stack coming to lws_csp_px

iwashiira on github https://github.com/warmcat/libwebsockets/issues/3140
found the html / css calculation could end up with NULL margin sizes.

This causes an assert if we get this unacceptable situation as far as
lws_csp_px()
This commit is contained in:
Andy Green 2024-05-12 05:27:43 +01:00
parent e0f401c0ac
commit bcde9a5b49

View file

@ -312,14 +312,19 @@ lws_css_compute_cascaded_length(lhp_ctx_t *ctx, int ref, lhp_pstack_t *ps,
const lws_fx_t *
lws_csp_px(const lcsp_atr_t *a, lhp_pstack_t *ps)
{
lhp_ctx_t *ctx = lws_container_of(ps->list.owner, lhp_ctx_t, stack);
const lws_display_font_t *f = ps->font;
lhp_ctx_t *ctx;
const lws_display_font_t *f;
lws_fx_t t1, t2, t3;
int ref;
assert(ps);
if (!a)
return NULL;
ctx = lws_container_of(ps->list.owner, lhp_ctx_t, stack);
f = ps->font;
ref = lhp_prop_axis(a);
switch (a->unit) {