Skip to content

Commit

Permalink
Guard null pointer use
Browse files Browse the repository at this point in the history
  • Loading branch information
magnesj committed Nov 14, 2023
1 parent 48c6517 commit d3a1c80
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,12 @@ bool RiuMainWindowBase::isBlockingViewSelectionOnSubWindowActivated() const
void RiuMainWindowBase::removeViewerFromMdiArea( RiuMdiArea* mdiArea, QWidget* viewer )
{
bool removedSubWindowWasActive = false;
bool wasMaximized = true;

QMdiSubWindow* subWindowBeingClosed = findMdiSubWindow( viewer );
bool wasMaximized = subWindowBeingClosed->isMaximized();
if ( subWindowBeingClosed )
if ( QMdiSubWindow* subWindowBeingClosed = findMdiSubWindow( viewer ) )
{
wasMaximized = subWindowBeingClosed->isMaximized();

if ( subWindowBeingClosed->isActiveWindow() )
{
// If we are removing the active window, we will need a new active window
Expand Down

0 comments on commit d3a1c80

Please sign in to comment.