mirror of
https://github.com/tmux/tmux.git
synced 2026-07-09 02:49:30 +00:00
Do not crash looking for next or previous session. GitHub issue 5344.
This commit is contained in:
@@ -435,6 +435,7 @@ server_destroy_session(struct session *s)
|
||||
{
|
||||
struct client *c;
|
||||
struct session *s_new = NULL, *cs_new = NULL, *use_s;
|
||||
struct sort_criteria sort_crit = { .order = SORT_NAME };
|
||||
int detach_on_destroy;
|
||||
|
||||
detach_on_destroy = options_get_number(s->options, "detach-on-destroy");
|
||||
@@ -443,9 +444,11 @@ server_destroy_session(struct session *s)
|
||||
else if (detach_on_destroy == 2)
|
||||
s_new = server_find_session(s, server_newer_detached_session);
|
||||
else if (detach_on_destroy == 3)
|
||||
s_new = session_previous_session(s, NULL);
|
||||
s_new = session_previous_session(s, &sort_crit);
|
||||
else if (detach_on_destroy == 4)
|
||||
s_new = session_next_session(s, NULL);
|
||||
s_new = session_next_session(s, &sort_crit);
|
||||
if (s_new == s)
|
||||
s_new = NULL;
|
||||
|
||||
/*
|
||||
* If no suitable new session was found above, then look for any
|
||||
|
||||
Reference in New Issue
Block a user