[gtk/issue-2900: 2/2] Add pre-condition check on nullable argument



commit 24d6a190af64348f5669e4e67e0dd78e59f94066
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sun Jun 28 13:40:11 2020 +0100

    Add pre-condition check on nullable argument
    
    Even if `gtk_expression_watch()` will do the same, we're calling public
    API, so we should perform a check at the point of use, to ensure that
    warnings are easily debuggable.

 gtk/gtkexpression.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/gtk/gtkexpression.c b/gtk/gtkexpression.c
index 750ee2c57c..a3ba536afa 100644
--- a/gtk/gtkexpression.c
+++ b/gtk/gtkexpression.c
@@ -1992,6 +1992,8 @@ gtk_expression_bind (GtkExpression *self,
   g_return_val_if_fail (GTK_IS_EXPRESSION (self), NULL);
   g_return_val_if_fail (G_IS_OBJECT (target), NULL);
   g_return_val_if_fail (property != NULL, NULL);
+  g_return_val_if_fail (this_ == NULL || G_IS_OBJECT (this_), NULL);
+
   pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (target), property);
   if (G_UNLIKELY (pspec == NULL))
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]