Avoid creating empty bitmap in MSW wxNotebook::OnPaint()

It can apparently happen that the window has 0 size and in this creating
the bitmap is useless and just triggers an assert.

Closes #18879.
This commit is contained in:
Vadim Zeitlin
2021-01-25 00:32:12 +01:00
parent e094734a89
commit b48c46285c

View File

@@ -787,11 +787,13 @@ void wxNotebook::OnEraseBackground(wxEraseEvent& WXUNUSED(event))
void wxNotebook::OnPaint(wxPaintEvent& WXUNUSED(event))
{
wxPaintDC dc(this);
wxMemoryDC memdc;
RECT rc;
::GetClientRect(GetHwnd(), &rc);
if ( !rc.right || !rc.bottom )
return;
wxBitmap bmp(rc.right, rc.bottom);
memdc.SelectObject(bmp);
wxMemoryDC memdc(bmp);
const wxLayoutDirection dir = dc.GetLayoutDirection();
memdc.SetLayoutDirection(dir);