diff options
| author | Jabiertxof <jabier.arraiza@marker.es> | 2018-10-01 19:55:33 +0000 |
|---|---|---|
| committer | Jabiertxof <jabier.arraiza@marker.es> | 2018-10-01 19:55:33 +0000 |
| commit | e4ee2f0cbd100200fbd8d4d6f9bbebc8a61c1b8c (patch) | |
| tree | 42115e4aba567e20400113fba1ed8476d79285ae /src/live_effects | |
| parent | Merge branch 'master' of gitlab.com:inkscape/inkscape (diff) | |
| download | inkscape-e4ee2f0cbd100200fbd8d4d6f9bbebc8a61c1b8c.tar.gz inkscape-e4ee2f0cbd100200fbd8d4d6f9bbebc8a61c1b8c.zip | |
Fix warnings in LPE ruler
Diffstat (limited to 'src/live_effects')
| -rw-r--r-- | src/live_effects/lpe-ruler.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/live_effects/lpe-ruler.cpp b/src/live_effects/lpe-ruler.cpp index 929bb0a70..8063f0cf3 100644 --- a/src/live_effects/lpe-ruler.cpp +++ b/src/live_effects/lpe-ruler.cpp @@ -77,10 +77,13 @@ LPERuler::ruler_mark(Geom::Point const &A, Geom::Point const &n, MarkType const double real_mark_length = mark_length; SPDocument * document = SP_ACTIVE_DOCUMENT; - real_mark_length = Inkscape::Util::Quantity::convert(real_mark_length, unit.get_abbreviation(), document->getDisplayUnit()->abbr.c_str()); + if (document) { + real_mark_length = Inkscape::Util::Quantity::convert(real_mark_length, unit.get_abbreviation(), document->getDisplayUnit()->abbr.c_str()); + } double real_minor_mark_length = minor_mark_length; - real_minor_mark_length = Inkscape::Util::Quantity::convert(real_minor_mark_length, unit.get_abbreviation(), document->getDisplayUnit()->abbr.c_str()); - + if (document) { + real_minor_mark_length = Inkscape::Util::Quantity::convert(real_minor_mark_length, unit.get_abbreviation(), document->getDisplayUnit()->abbr.c_str()); + } n_major = real_mark_length * n; n_minor = real_minor_mark_length * n; if (mark_dir == MARKDIR_BOTH) { @@ -130,10 +133,13 @@ LPERuler::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_i double real_mark_distance = mark_distance; SPDocument * document = SP_ACTIVE_DOCUMENT; - real_mark_distance = Inkscape::Util::Quantity::convert(real_mark_distance, unit.get_abbreviation(), document->getDisplayUnit()->abbr.c_str()); - + if (document) { + real_mark_distance = Inkscape::Util::Quantity::convert(real_mark_distance, unit.get_abbreviation(), document->getDisplayUnit()->abbr.c_str()); + } double real_offset = offset; - real_offset = Inkscape::Util::Quantity::convert(real_offset, unit.get_abbreviation(), document->getDisplayUnit()->abbr.c_str()); + if (document) { + real_offset = Inkscape::Util::Quantity::convert(real_offset, unit.get_abbreviation(), document->getDisplayUnit()->abbr.c_str()); + } for (double s = real_offset; s<totlength; s+=real_mark_distance){ s_cuts.push_back(s); } |
