Code

Switch selection bounds and center to use NR::Maybe, addressing most of the
[inkscape.git] / src / file.cpp
index f4630719b27eb88f0343c1f25c6d3a6814c99483..c1d03554566a1bd244d71d3e042515d68e53716e 100644 (file)
@@ -834,8 +834,11 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri,
                 int const saved_pref = prefs_get_int_attribute("options.transform", "pattern", 1);
                 prefs_set_int_attribute("options.transform", "pattern", 1);
                 sp_document_ensure_up_to_date(sp_desktop_document(desktop));
-                NR::Point m( desktop->point() - selection->bounds().midpoint() );
-                sp_selection_move_relative(selection, m);
+                NR::Maybe<NR::Rect> sel_bbox = selection->bounds();
+                if (sel_bbox) {
+                    NR::Point m( desktop->point() - sel_bbox->midpoint() );
+                    sp_selection_move_relative(selection, m);
+                }
                 prefs_set_int_attribute("options.transform", "pattern", saved_pref);
             }
         }