Fix NULL pointer deref when calc borders and gaps
This commit is contained in:
parent
4992ee09c4
commit
d794be4c49
|
@ -20,8 +20,10 @@ centeredmaster(Monitor *m)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const int gap_size = helpers_gap_size(n, m->sel->isfullscreen);
|
const bool is_fullscreen = m->sel == NULL ? false : m->sel->isfullscreen;
|
||||||
const int border_width = helpers_border_width(n, m->sel->isfullscreen);
|
|
||||||
|
const int gap_size = helpers_gap_size(n, is_fullscreen);
|
||||||
|
const int border_width = helpers_border_width(n, is_fullscreen);
|
||||||
|
|
||||||
const int top_left_half_gap = gap_size / 2;
|
const int top_left_half_gap = gap_size / 2;
|
||||||
const int bottom_right_half_gap = gap_size - top_left_half_gap;
|
const int bottom_right_half_gap = gap_size - top_left_half_gap;
|
||||||
|
@ -99,8 +101,10 @@ centeredmaster(Monitor *m)
|
||||||
void
|
void
|
||||||
monocle(Monitor *m)
|
monocle(Monitor *m)
|
||||||
{
|
{
|
||||||
const int gap_size = helpers_gap_size(1, m->sel->isfullscreen);
|
const bool is_fullscreen = m->sel == NULL ? false : m->sel->isfullscreen;
|
||||||
const int border_width = helpers_border_width(1, m->sel->isfullscreen);
|
|
||||||
|
const int gap_size = helpers_gap_size(1, is_fullscreen);
|
||||||
|
const int border_width = helpers_border_width(1, is_fullscreen);
|
||||||
|
|
||||||
for (Client *c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
|
for (Client *c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
|
||||||
resize(
|
resize(
|
||||||
|
@ -122,8 +126,10 @@ tile(Monitor *m)
|
||||||
for (Client *c = nexttiled(m->clients); c; c = nexttiled(c->next), ++n);
|
for (Client *c = nexttiled(m->clients); c; c = nexttiled(c->next), ++n);
|
||||||
if (n == 0) return;
|
if (n == 0) return;
|
||||||
|
|
||||||
const int gap_size = helpers_gap_size(n, m->sel->isfullscreen);
|
const bool is_fullscreen = m->sel == NULL ? false : m->sel->isfullscreen;
|
||||||
const int border_width = helpers_border_width(n, m->sel->isfullscreen);
|
|
||||||
|
const int gap_size = helpers_gap_size(n, is_fullscreen);
|
||||||
|
const int border_width = helpers_border_width(n, is_fullscreen);
|
||||||
|
|
||||||
const int top_left_half_gap = gap_size / 2;
|
const int top_left_half_gap = gap_size / 2;
|
||||||
const int bottom_right_half_gap = gap_size - top_left_half_gap;
|
const int bottom_right_half_gap = gap_size - top_left_half_gap;
|
||||||
|
|
Loading…
Reference in New Issue