From f007608c81ecc0a3e668b05751407bf651621ed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Tr=C3=B6ger?= Date: Tue, 24 Sep 2013 17:05:50 +0000 Subject: [PATCH] throw exception at unsuported geometrie instead of crashing --- src/Mod/Assembly/App/Constraint.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Mod/Assembly/App/Constraint.cpp b/src/Mod/Assembly/App/Constraint.cpp index 0343a39f7..516f63246 100644 --- a/src/Mod/Assembly/App/Constraint.cpp +++ b/src/Mod/Assembly/App/Constraint.cpp @@ -56,6 +56,9 @@ using namespace Assembly; namespace Assembly { +struct ConstraintInitException : std::exception { + const char* what() const throw() { return "Constraint cout not be initialised: unsoported geometry";} +}; PROPERTY_SOURCE(Assembly::Constraint, App::DocumentObject) @@ -102,6 +105,9 @@ void Constraint::init(Assembly::ItemAssembly* ass) { m_first_geom = initLink(First); m_second_geom = initLink(Second); + + if(!m_first_geom || !m_second_geom) + throw ConstraintInitException(); } PyObject *Constraint::getPyObject(void)