fix: some case crash when use multi session

This commit is contained in:
DreamMaoMao 2025-05-19 08:04:38 +08:00
parent b57acbcc1d
commit 50020fb57e

View file

@ -1893,7 +1893,7 @@ applyrules(Client *c) {
int fullscreen_state_backup = c->isfullscreen;
setmon(c, mon, newtags, !c->isopensilent);
if (!c->isopensilent && !(c->tags & (1 << (selmon->pertag->curtag - 1)))) {
if (!c->isopensilent && selmon && !(c->tags & (1 << (selmon->pertag->curtag - 1)))) {
c->animation.from_rule = true;
view(&(Arg){.ui = c->tags}, true);
}
@ -4447,12 +4447,12 @@ mapnotify(struct wl_listener *listener, void *data) {
c->drag_to_tile = false;
c->fake_no_border = false;
if (new_is_master &&
if (new_is_master && selmon &&
strcmp(selmon->pertag->ltidxs[selmon->pertag->curtag]->name,
"scroller") != 0)
// tile at the top
wl_list_insert(&clients, &c->link); // 新窗口是master,头部入栈
else if (strcmp(selmon->pertag->ltidxs[selmon->pertag->curtag]->name,
else if (selmon && strcmp(selmon->pertag->ltidxs[selmon->pertag->curtag]->name,
"scroller") == 0 &&
center_select(selmon)) {
Client *at_client = center_select(selmon);