Fixed null pointer bug in DockFocusController.cpp

This commit is contained in:
Uwe Kindler 2021-10-11 21:20:21 +02:00
parent 87b0596ebc
commit 89aa3d5251

View File

@ -116,7 +116,13 @@ void DockFocusControllerPrivate::updateDockWidgetFocus(CDockWidget* DockWidget)
return; return;
} }
auto Window = DockWidget->dockContainer()->window()->windowHandle(); QWindow* Window = nullptr;
auto DockContainer = DockWidget->dockContainer();
if (DockContainer)
{
Window = DockContainer->window()->windowHandle();
}
if (Window) if (Window)
{ {
Window->setProperty("FocusedDockWidget", QVariant::fromValue<CDockWidget*>(DockWidget)); Window->setProperty("FocusedDockWidget", QVariant::fromValue<CDockWidget*>(DockWidget));
@ -145,7 +151,14 @@ void DockFocusControllerPrivate::updateDockWidgetFocus(CDockWidget* DockWidget)
} }
auto NewFloatingWidget = FocusedDockWidget->dockContainer()->floatingWidget();
CFloatingDockContainer* NewFloatingWidget = nullptr;
DockContainer = FocusedDockWidget->dockContainer();
if (DockContainer)
{
NewFloatingWidget = DockContainer->floatingWidget();
}
if (NewFloatingWidget) if (NewFloatingWidget)
{ {
NewFloatingWidget->setProperty("FocusedDockWidget", QVariant::fromValue(DockWidget)); NewFloatingWidget->setProperty("FocusedDockWidget", QVariant::fromValue(DockWidget));