diff --git a/src/box3d-side.cpp b/src/box3d-side.cpp
index f09a2f9f6eb369620da9a63a354d6e0e401efe86..69bae53d93b696fb1f362d85b7ac2bee9650a1f3 100644 (file)
--- a/src/box3d-side.cpp
+++ b/src/box3d-side.cpp
static void box3d_side_class_init (Box3DSideClass *klass);
static void box3d_side_init (Box3DSide *side);
-static void box3d_side_build (SPObject *object, Document *document, Inkscape::XML::Node *repr);
+static void box3d_side_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static Inkscape::XML::Node *box3d_side_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static void box3d_side_set (SPObject *object, unsigned int key, const gchar *value);
static void box3d_side_update (SPObject *object, SPCtx *ctx, guint flags);
}
static void
-box3d_side_build (SPObject * object, Document * document, Inkscape::XML::Node * repr)
+box3d_side_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr)
{
if (((SPObjectClass *) parent_class)->build)
((SPObjectClass *) parent_class)->build (object, document, repr);
box3d_side_compute_corner_ids(side, corners);
SPCurve *c = new SPCurve();
+
+ if (!box3d_get_corner_screen(box, corners[0]).isFinite() ||
+ !box3d_get_corner_screen(box, corners[1]).isFinite() ||
+ !box3d_get_corner_screen(box, corners[2]).isFinite() ||
+ !box3d_get_corner_screen(box, corners[3]).isFinite() )
+ {
+ g_warning ("Trying to draw a 3D box side with invalid coordinates.\n");
+ return;
+ }
+
c->moveto(box3d_get_corner_screen(box, corners[0]));
c->lineto(box3d_get_corner_screen(box, corners[1]));
c->lineto(box3d_get_corner_screen(box, corners[2]));
Inkscape::XML::Node *
box3d_side_convert_to_path(Box3DSide *side) {
// TODO: Copy over all important attributes (see sp_selected_item_to_curved_repr() for an example)
- Document *doc = SP_OBJECT_DOCUMENT(side);
+ SPDocument *doc = SP_OBJECT_DOCUMENT(side);
Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
Inkscape::XML::Node *repr = xml_doc->createElement("svg:path");