Not toggle floating on a CT_FLOATING_CON

See the issue #1875.
Forbid the command to toggle floating on a CT_FLOATING_CON to avoid the crash.
This commit is contained in:
hwangcc23 2015-09-22 23:04:10 +08:00
parent a2aec4ee92
commit 94e7d13e17
1 changed files with 6 additions and 0 deletions

View File

@ -369,6 +369,12 @@ void floating_disable(Con *con, bool automatic) {
* *
*/ */
void toggle_floating_mode(Con *con, bool automatic) { void toggle_floating_mode(Con *con, bool automatic) {
/* forbid the command to toggle floating on a CT_FLOATING_CON */
if (con->type == CT_FLOATING_CON) {
ELOG("Cannot toggle floating mode on con = %p because it is of type CT_FLOATING_CON.\n", con);
return;
}
/* see if the client is already floating */ /* see if the client is already floating */
if (con_is_floating(con)) { if (con_is_floating(con)) {
LOG("already floating, re-setting to tiling\n"); LOG("already floating, re-setting to tiling\n");