diff options
author | David Robillard <d@drobilla.net> | 2012-04-23 01:47:20 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-04-23 01:47:20 +0000 |
commit | 298bc503de64b3f42f71ecbd6009a32f9448bdb9 (patch) | |
tree | 89c88265236a5f85e991116b933b2160b87e1579 /src/port.c | |
parent | f77f74472a6e46c0af101e7f1d52635c0147efd9 (diff) | |
download | ganv-298bc503de64b3f42f71ecbd6009a32f9448bdb9.tar.gz ganv-298bc503de64b3f42f71ecbd6009a32f9448bdb9.tar.bz2 ganv-298bc503de64b3f42f71ecbd6009a32f9448bdb9.zip |
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
Diffstat (limited to 'src/port.c')
-rw-r--r-- | src/port.c | 32 |
1 files changed, 17 insertions, 15 deletions
@@ -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); |