mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
fodcusadjacenttag: Add selmon->sel guards for tagandviewtoleft/right to prevent segmentation faults ref. #191
This commit is contained in:
parent
ce270a320e
commit
84355a6d90
@ -63,7 +63,8 @@ viewtoright(const Arg *arg)
|
||||
void
|
||||
tagandviewtoleft(const Arg *arg)
|
||||
{
|
||||
if (__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
|
||||
if (selmon->sel != NULL
|
||||
&& __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
|
||||
&& selmon->tagset[selmon->seltags] > 1) {
|
||||
selmon->sel->tags >>= 1;
|
||||
selmon->seltags ^= 1; /* toggle sel tagset */
|
||||
@ -83,7 +84,8 @@ tagandviewtoleft(const Arg *arg)
|
||||
void
|
||||
tagandviewtoright(const Arg *arg)
|
||||
{
|
||||
if (__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
|
||||
if (selmon->sel != NULL
|
||||
&& __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
|
||||
&& selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
|
||||
selmon->sel->tags <<= 1;
|
||||
selmon->seltags ^= 1; /* toggle sel tagset */
|
||||
|
Loading…
Reference in New Issue
Block a user