From 888a0ad623528173be70795956663b799374d238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 2 Feb 2023 14:56:45 +0100 Subject: [PATCH] shell/window-preview-layout: Add precondition checks It's good practice to guard public API against programmer errors, so do that. https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6351 Part-of: --- src/shell-window-preview-layout.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/shell-window-preview-layout.c b/src/shell-window-preview-layout.c index 9cf6633b1..8d8596af4 100644 --- a/src/shell-window-preview-layout.c +++ b/src/shell-window-preview-layout.c @@ -366,6 +366,9 @@ shell_window_preview_layout_add_window (ShellWindowPreviewLayout *self, GHashTableIter iter; gpointer value; + g_return_val_if_fail (SHELL_IS_WINDOW_PREVIEW_LAYOUT (self), NULL); + g_return_val_if_fail (META_IS_WINDOW (window), NULL); + priv = shell_window_preview_layout_get_instance_private (self); g_hash_table_iter_init (&iter, priv->windows); @@ -425,6 +428,9 @@ shell_window_preview_layout_remove_window (ShellWindowPreviewLayout *self, GHashTableIter iter; gpointer key, value; + g_return_if_fail (SHELL_IS_WINDOW_PREVIEW_LAYOUT (self)); + g_return_if_fail (META_IS_WINDOW (window)); + priv = shell_window_preview_layout_get_instance_private (self); g_hash_table_iter_init (&iter, priv->windows); @@ -473,6 +479,8 @@ shell_window_preview_layout_get_windows (ShellWindowPreviewLayout *self) GHashTableIter iter; gpointer value; + g_return_val_if_fail (SHELL_IS_WINDOW_PREVIEW_LAYOUT (self), NULL); + priv = shell_window_preview_layout_get_instance_private (self); g_hash_table_iter_init (&iter, priv->windows);