From 7900a069c2822a141851e9416104d4961551f427 Mon Sep 17 00:00:00 2001 From: Aapo Date: Wed, 24 Feb 2021 21:56:39 +0200 Subject: [PATCH] [TD] DrawViewPart.cpp: Fix a crash when user sets the PropertyVector Direction to zero. --- src/Mod/TechDraw/App/DrawViewPart.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Mod/TechDraw/App/DrawViewPart.cpp b/src/Mod/TechDraw/App/DrawViewPart.cpp index 3c1aeea98c..658b194c04 100644 --- a/src/Mod/TechDraw/App/DrawViewPart.cpp +++ b/src/Mod/TechDraw/App/DrawViewPart.cpp @@ -335,6 +335,13 @@ short DrawViewPart::mustExecute() const void DrawViewPart::onChanged(const App::Property* prop) { + // If the user has set PropertyVector Direction to zero, set it along the default value instead (Front View). + // Otherwise bad things will happen because there'll be a normalization for direction calculations later. + Base::Vector3d dir = Direction.getValue(); + if (DrawUtil::fpCompare(dir.Length(), 0.0)) { + Direction.setValue(Base::Vector3d(0.0, -1.0, 0.0)); + } + DrawView::onChanged(prop); //TODO: when scale changes, any Dimensions for this View sb recalculated. DVD should pick this up subject to topological naming issues.