]> saetta.ns0.it Git - libgtkform/commitdiff
Bugfix on GtkForm::get_objects_by_name when object not found.
authorAndrea Zagli <azagli@libero.it>
Sat, 6 Mar 2010 11:15:04 +0000 (12:15 +0100)
committerAndrea Zagli <azagli@libero.it>
Sat, 6 Mar 2010 11:15:04 +0000 (12:15 +0100)
src/form.c

index a1f5151ba7375686e6a5a6eb7c060087d5febdd9..0753e0594d77a3d90ba004a3ffc3672c1a7e7a69 100644 (file)
@@ -889,22 +889,24 @@ GObject
 
        while ((object_name = va_arg (vargs, gchar *)) != NULL)
                {
+                       l++;
+                       if (l == 1)
+                               {
+                                       ret = g_malloc (sizeof (GObject *));
+                               }
+                       else
+                               {
+                                       ret = g_realloc (ret, l * sizeof (GObject *));
+                               }
+
                        object = gtk_builder_get_object (priv->gtkbuilder, object_name);
                        if (G_IS_OBJECT (object))
                                {
-                                       l++;
-                                       if (l == 1)
-                                               {
-                                                       ret = g_malloc (sizeof (GObject *));
-                                               }
-                                       else
-                                               {
-                                                       ret = g_realloc (ret, l * sizeof (GObject *));
-                                               }
                                        ret[l - 1] = object;
                                }
                        else
                                {
+                                       ret[l - 1] = NULL;
                                        g_warning (_("Object «%s» not found."), object_name);
                                }
                }