workspace: Downgrade abort() to a warning when getting index

Instead of crashing on invalid input, just log a warning and return -1.
This will hopefully result in less abort():y behavior with missbehaving
Javascript code.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4203
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2134>
This commit is contained in:
Jonas Ådahl 2021-12-04 23:39:58 +01:00 committed by Marge Bot
parent b77cb09bac
commit 4469042e2a

View File

@ -717,9 +717,7 @@ meta_workspace_index (MetaWorkspace *workspace)
int ret;
ret = g_list_index (workspace->manager->workspaces, workspace);
if (ret < 0)
meta_bug ("Workspace does not exist to index!");
g_return_val_if_fail (ret >= 0, -1);
return ret;
}