diff options
| author | Tim Dwyer <tgdwyer@gmail.com> | 2007-03-16 04:59:02 +0000 |
|---|---|---|
| committer | tgdwyer <tgdwyer@users.sourceforge.net> | 2007-03-16 04:59:02 +0000 |
| commit | 1ff2806a03820272c62c679ac2c2be449963e60c (patch) | |
| tree | 77d13411490f9a146ed9d85f0dd11591446f3504 /src/graphlayout | |
| parent | give new flowtext the current text tool style (diff) | |
| download | inkscape-1ff2806a03820272c62c679ac2c2be449963e60c.tar.gz inkscape-1ff2806a03820272c62c679ac2c2be449963e60c.zip | |
Added check for null bounding box of shapes involved in graph layout.
I'm not actually sure if it's possible for something with a
NULL item-box to be attached to a connector but if it is
it's probably pretty safe to simply ignore.
(bzr r2669)
Diffstat (limited to 'src/graphlayout')
| -rw-r--r-- | src/graphlayout/graphlayout.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/graphlayout/graphlayout.cpp b/src/graphlayout/graphlayout.cpp index 780532718..a111d7afe 100644 --- a/src/graphlayout/graphlayout.cpp +++ b/src/graphlayout/graphlayout.cpp @@ -94,12 +94,19 @@ void graphlayout(GSList const *const items) { { SPItem *u=*i; NR::Maybe<NR::Rect> const item_box(sp_item_bbox_desktop(u)); - g_assert(item_box); - NR::Point ll(item_box->min()); - NR::Point ur(item_box->max()); - nodelookup[u->id]=rs.size(); - rs.push_back(new Rectangle(ll[0]-spacing,ur[0]+spacing, - ll[1]-spacing,ur[1]+spacing)); + if(item_box) { + NR::Point ll(item_box->min()); + NR::Point ur(item_box->max()); + nodelookup[u->id]=rs.size(); + rs.push_back(new Rectangle(ll[0]-spacing,ur[0]+spacing, + ll[1]-spacing,ur[1]+spacing)); + } else { + // I'm not actually sure if it's possible for something with a + // NULL item-box to be attached to a connector in which case we + // should never get to here... but if such a null box can occur it's + // probably pretty safe to simply ignore + //fprintf(stderr,"NULL item_box found in graphlayout, ignoring!\n"); + } } SimpleConstraints scx,scy; @@ -190,10 +197,11 @@ void graphlayout(GSList const *const items) { if(!isConnector(u)) { Rectangle* r=rs[nodelookup[u->id]]; NR::Maybe<NR::Rect> item_box(sp_item_bbox_desktop(u)); - g_assert(item_box); - NR::Point const curr(item_box->midpoint()); - NR::Point const dest(r->getCentreX(),r->getCentreY()); - sp_item_move_rel(u, NR::translate(dest - curr)); + if(item_box) { + NR::Point const curr(item_box->midpoint()); + NR::Point const dest(r->getCentreX(),r->getCentreY()); + sp_item_move_rel(u, NR::translate(dest - curr)); + } } } for(unsigned i=0;i<scx.size();i++) { |
