Skip to content

Commit

Permalink
[TD]fix fail when dropping onto corrupt object
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan committed Dec 29, 2023
1 parent 888dcb5 commit f2fe61b
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/Mod/TechDraw/Gui/ViewProviderDrawingViewExtension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,24 @@ void ViewProviderDrawingViewExtension::extensionDragObject(App::DocumentObject*
//extension to try to drop on us and cause problems
bool ViewProviderDrawingViewExtension::extensionCanDropObjects() const { return true; }

//let the page have any drops we receive
//let the page have any drops we receive.
bool ViewProviderDrawingViewExtension::extensionCanDropObject(App::DocumentObject* obj) const
{
// it can happen that if the tree gets badly corrupted, there can be loose
// objects that have no page or view provider, so we need to check that
// all these objects exist.
auto vpdv = getViewProviderDrawingView();
if (!vpdv) {
return false;
}
auto vpp = vpdv->getViewProviderPage();
if (!vpp) {
return false;
}
auto vppEx = vpp->getVPPExtension();
if (!vppEx) {
return false;
}
return getViewProviderDrawingView()
->getViewProviderPage()
->getVPPExtension()
Expand Down

0 comments on commit f2fe61b

Please sign in to comment.