Gui: Fix segfault in ViewProviderPlane::getRole
This commit is contained in:
committed by
Benjamin Nauck
parent
c1dd116e1e
commit
0677982c8b
@@ -170,6 +170,10 @@ void ViewProviderPlane::onSelectionChanged(const SelectionChanges&)
|
||||
|
||||
void ViewProviderPlane::updatePlaneSize()
|
||||
{
|
||||
if (!pcObject->isAttachedToDocument()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto params = ViewParams::instance();
|
||||
|
||||
const float size = params->getDatumPlaneSize() * Base::fromPercent(params->getDatumScale());
|
||||
@@ -230,6 +234,11 @@ std::string ViewProviderPlane::getRole() const
|
||||
{
|
||||
// Note: Role property of App::Plane is not set yet when attaching.
|
||||
const char* name = pcObject->getNameInDocument();
|
||||
|
||||
if (!pcObject->isAttachedToDocument()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
auto planesRoles = App::LocalCoordinateSystem::PlaneRoles;
|
||||
if (strncmp(name, planesRoles[0], strlen(planesRoles[0])) == 0) {
|
||||
return planesRoles[0];
|
||||
|
||||
Reference in New Issue
Block a user