con_swap: exit when first _con_move_to_con fails
This is enough to fix the crash discussed in #3259 even though the next commit can fix it independently. This commit is useful because it generally makes sense to abort the command when the first call to _con_move_to_con fails.
This commit is contained in:
parent
5a0f02b7ff
commit
799e3951a2
|
@ -2373,6 +2373,10 @@ bool con_swap(Con *first, Con *second) {
|
|||
|
||||
/* Move first to second. */
|
||||
result &= _con_move_to_con(first, second, false, false, false, true, false);
|
||||
/* If swapping the containers didn't work we don't need to mess with the focus. */
|
||||
if (!result) {
|
||||
goto swap_end;
|
||||
}
|
||||
|
||||
/* If we moved the container holding the focused window to another
|
||||
* workspace we need to ensure the visible workspace has the focused
|
||||
|
@ -2385,8 +2389,6 @@ bool con_swap(Con *first, Con *second) {
|
|||
|
||||
/* Move second to where first has been originally. */
|
||||
result &= _con_move_to_con(second, fake, false, false, false, true, false);
|
||||
|
||||
/* If swapping the containers didn't work we don't need to mess with the focus. */
|
||||
if (!result) {
|
||||
goto swap_end;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue