fix(policy): 移动窗口所在 workspace 前先检查目标 workspace 是否存在

This commit is contained in:
2026-05-31 18:42:51 +08:00
parent 59520777c3
commit 83ed661ba6

View File

@@ -330,11 +330,12 @@ static void send_window_to_workspace_same_output_by_index(
const zdwm_action_data_window_send_to_workspace_t *data, const zdwm_action_data_window_send_to_workspace_t *data,
command_buffer_t *command_buffer command_buffer_t *command_buffer
) { ) {
auto target_workspace = state_workspace_at(state, (size_t)data->index);
if (!target_workspace) return;
auto output = state_output_at(state, state->current_output_index); auto output = state_output_at(state, state->current_output_index);
auto current_workspace = auto current_workspace =
state_workspace_get(state, output->current_workspace_id); state_workspace_get(state, output->current_workspace_id);
auto target_workspace = state_workspace_at(state, (size_t)data->index);
if (current_workspace->id == target_workspace->id) return; if (current_workspace->id == target_workspace->id) return;
if (data->switch_workspace) { if (data->switch_workspace) {