From 5398276c4ef0998c720a182c99b71ccf5335e4e6 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sun, 5 Jan 2025 23:05:37 +0100 Subject: [PATCH] Part: When saving shape in binary mode then continue even if it's empty --- src/Mod/Part/App/PropertyTopoShape.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Mod/Part/App/PropertyTopoShape.cpp b/src/Mod/Part/App/PropertyTopoShape.cpp index 17c4123325ed..08e91e7894b3 100644 --- a/src/Mod/Part/App/PropertyTopoShape.cpp +++ b/src/Mod/Part/App/PropertyTopoShape.cpp @@ -561,10 +561,6 @@ void PropertyPartShape::loadFromStream(Base::Reader &reader) void PropertyPartShape::SaveDocFile (Base::Writer &writer) const { - // If the shape is empty we simply store nothing. The file size will be 0 which - // can be checked when reading in the data. - if (_Shape.getShape().IsNull()) - return; TopoDS_Shape myShape = _Shape.getShape(); if (writer.getMode("BinaryBrep")) { TopoShape shape; @@ -572,6 +568,11 @@ void PropertyPartShape::SaveDocFile (Base::Writer &writer) const shape.exportBinary(writer.Stream()); } else { + // If the shape is empty we simply store nothing. The file size will be 0 which + // can be checked when reading in the data. + if (_Shape.getShape().IsNull()) { + return; + } bool direct = App::GetApplication().GetParameterGroupByPath ("User parameter:BaseApp/Preferences/Mod/Part/General")->GetBool("DirectAccess", true); if (!direct) {