From 298bc503de64b3f42f71ecbd6009a32f9448bdb9 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 23 Apr 2012 01:47:20 +0000 Subject: Fix errors when port has no label.ganv/src/port.c git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@4249 a436a847-0d15-0410-975c-d299462d15a1 --- src/port.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'src/port.c') diff --git a/src/port.c b/src/port.c index f377b79..6ce37d0 100644 --- a/src/port.c +++ b/src/port.c @@ -189,21 +189,23 @@ ganv_port_resize(GanvNode* self) GanvPort* port = GANV_PORT(self); GanvNode* node = GANV_NODE(self); - double label_w, label_h; - g_object_get(node->impl->label, - "width", &label_w, - "height", &label_h, - NULL); - - ganv_box_set_width(&port->box, MAX(ganv_box_get_width(&port->box), - label_w + (PORT_LABEL_HPAD * 2.0))); - ganv_box_set_height(&port->box, MAX(ganv_box_get_height(&port->box), - label_h + (PORT_LABEL_VPAD * 2.0))); - - ganv_item_set(GANV_ITEM(node->impl->label), - "x", PORT_LABEL_HPAD, - "y", PORT_LABEL_VPAD, - NULL); + if (node->impl->label) { + double label_w, label_h; + g_object_get(node->impl->label, + "width", &label_w, + "height", &label_h, + NULL); + + ganv_box_set_width(&port->box, MAX(ganv_box_get_width(&port->box), + label_w + (PORT_LABEL_HPAD * 2.0))); + ganv_box_set_height(&port->box, MAX(ganv_box_get_height(&port->box), + label_h + (PORT_LABEL_VPAD * 2.0))); + + ganv_item_set(GANV_ITEM(node->impl->label), + "x", PORT_LABEL_HPAD, + "y", PORT_LABEL_VPAD, + NULL); + } if (parent_class->parent_class.resize) { parent_class->parent_class.resize(self); -- cgit v1.2.1