From 4b8f566304fe208021dab177d99fad7921d1c5f1 Mon Sep 17 00:00:00 2001 From: Friedrich21 Date: Sat, 13 Feb 2021 01:11:37 +0000 Subject: [PATCH] Removed unnecessary check. c. f. https://stackoverflow.com/a/11279743 (found by Cppcheck) --- src/document.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/document.cpp b/src/document.cpp index 7e99635277..7a6a7d26ce 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -851,16 +851,14 @@ void SPDocument::fitToRect(Geom::Rect const &rect, bool with_margins) double margin_bottom = 0.0; if (with_margins && nv) { - if (nv != nullptr) { - margin_top = nv->getMarginLength("fit-margin-top", nv_units, unit_table.getUnit("px"), w, h, false); - margin_left = nv->getMarginLength("fit-margin-left", nv_units, unit_table.getUnit("px"), w, h, true); - margin_right = nv->getMarginLength("fit-margin-right", nv_units, unit_table.getUnit("px"), w, h, true); - margin_bottom = nv->getMarginLength("fit-margin-bottom", nv_units, unit_table.getUnit("px"), w, h, false); - margin_top = Inkscape::Util::Quantity::convert(margin_top, nv_units, "px"); - margin_left = Inkscape::Util::Quantity::convert(margin_left, nv_units, "px"); - margin_right = Inkscape::Util::Quantity::convert(margin_right, nv_units, "px"); - margin_bottom = Inkscape::Util::Quantity::convert(margin_bottom, nv_units, "px"); - } + margin_top = nv->getMarginLength("fit-margin-top", nv_units, unit_table.getUnit("px"), w, h, false); + margin_left = nv->getMarginLength("fit-margin-left", nv_units, unit_table.getUnit("px"), w, h, true); + margin_right = nv->getMarginLength("fit-margin-right", nv_units, unit_table.getUnit("px"), w, h, true); + margin_bottom = nv->getMarginLength("fit-margin-bottom", nv_units, unit_table.getUnit("px"), w, h, false); + margin_top = Inkscape::Util::Quantity::convert(margin_top, nv_units, "px"); + margin_left = Inkscape::Util::Quantity::convert(margin_left, nv_units, "px"); + margin_right = Inkscape::Util::Quantity::convert(margin_right, nv_units, "px"); + margin_bottom = Inkscape::Util::Quantity::convert(margin_bottom, nv_units, "px"); } double y_dir = yaxisdir(); -- GitLab