Avoid potential NULL pointer dereferences
svn path=/trunk/netsurf/; revision=9680
This commit is contained in:
parent
9ca1622183
commit
d010712a9c
|
@ -389,15 +389,17 @@ bool layout_block_context(struct box *block, int viewport_height,
|
|||
layout_block_add_scrollbar(box, BOTTOM);
|
||||
}
|
||||
} else if (box->type == BOX_TABLE) {
|
||||
if (box->style != NULL) {
|
||||
enum css_width_e wtype;
|
||||
css_fixed width = 0;
|
||||
css_unit unit = CSS_UNIT_PX;
|
||||
|
||||
wtype = css_computed_width(box->style, &width, &unit);
|
||||
wtype = css_computed_width(box->style, &width,
|
||||
&unit);
|
||||
|
||||
if (wtype == CSS_WIDTH_AUTO) {
|
||||
/* max available width may be diminished due to
|
||||
* floats. */
|
||||
/* max available width may be
|
||||
* diminished due to floats. */
|
||||
int x0, x1, top;
|
||||
struct box *left, *right;
|
||||
top = cy > y ? cy : y;
|
||||
|
@ -406,16 +408,18 @@ bool layout_block_context(struct box *block, int viewport_height,
|
|||
x1 = cx + box->parent->width -
|
||||
box->parent->padding[LEFT] -
|
||||
box->parent->padding[RIGHT];
|
||||
find_sides(block->float_children, top, top,
|
||||
&x0, &x1, &left, &right);
|
||||
/* calculate min required left & right margins
|
||||
* needed to avoid floats */
|
||||
find_sides(block->float_children,
|
||||
top, top, &x0, &x1,
|
||||
&left, &right);
|
||||
/* calculate min required left & right
|
||||
* margins needed to avoid floats */
|
||||
lm = x0 - cx;
|
||||
rm = cx + box->parent->width -
|
||||
box->parent->padding[LEFT] -
|
||||
box->parent->padding[RIGHT] -
|
||||
x1;
|
||||
}
|
||||
}
|
||||
if (!layout_table(box, box->parent->width - lm - rm,
|
||||
content))
|
||||
return false;
|
||||
|
@ -661,6 +665,7 @@ void layout_minmax_block(struct box *block,
|
|||
if (block->max_width != UNKNOWN_MAX_WIDTH)
|
||||
return;
|
||||
|
||||
if (block->style != NULL)
|
||||
wtype = css_computed_width(block->style, &width, &wunit);
|
||||
|
||||
if (block->gadget && (block->gadget->type == GADGET_TEXTBOX ||
|
||||
|
@ -880,11 +885,12 @@ bool layout_apply_minmax_height(struct box *box, struct box *container)
|
|||
bool updated = false;
|
||||
|
||||
/* Find containing block for percentage heights */
|
||||
if (css_computed_position(box->style) == CSS_POSITION_ABSOLUTE) {
|
||||
if (box->style != NULL && css_computed_position(box->style) ==
|
||||
CSS_POSITION_ABSOLUTE) {
|
||||
/* Box is absolutely positioned */
|
||||
assert(container);
|
||||
containing_block = container;
|
||||
} else if (box->float_container &&
|
||||
} else if (box->float_container && box->style != NULL &&
|
||||
(css_computed_float(box->style) == CSS_FLOAT_LEFT ||
|
||||
css_computed_float(box->style) == CSS_FLOAT_RIGHT)) {
|
||||
/* Box is a float */
|
||||
|
|
Loading…
Reference in New Issue