From 537dc5f290720e0884b8bbe9378a7f9f60170009 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 26 Aug 2023 23:22:03 +0200 Subject: [PATCH] Fix crash on DPI change for wxStaticBox without a control label Check that we have a label before repositioning it fix the crash introduced by 54684be79d (Fix position of label window in wxStaticBox after DPI change, 2023-08-05). See #23740, #23826. (cherry picked from commit 329d35b922aa893c292d14061fb099aacb4af20b) --- src/msw/statbox.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/msw/statbox.cpp b/src/msw/statbox.cpp index 3d8e4562e2..75460e5e60 100644 --- a/src/msw/statbox.cpp +++ b/src/msw/statbox.cpp @@ -310,7 +310,8 @@ WXLRESULT wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPar void wxStaticBox::OnDPIChanged(wxDPIChangedEvent& WXUNUSED(event)) { - PositionLabelWindow(); + if ( m_labelWin ) + PositionLabelWindow(); } // ----------------------------------------------------------------------------