From d28fb3eb2bc94b50d1e4c0ac8f9912c0aaf253a6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 27 Feb 2008 18:03:12 +0000 Subject: [PATCH] don't attempt to create 0*0 bitmaps in GetBuffer() (patch 1899643) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@52152 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/dcbufcmn.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/common/dcbufcmn.cpp b/src/common/dcbufcmn.cpp index ed6bb0e7bb..63ce5b7fe4 100644 --- a/src/common/dcbufcmn.cpp +++ b/src/common/dcbufcmn.cpp @@ -53,6 +53,14 @@ public: h > ms_buffer->GetHeight() ) { delete ms_buffer; + + // we must always return a valid bitmap but creating a bitmap of + // size 0 would fail, so create a 1*1 bitmap in this case + if ( !w ) + w = 1; + if ( !h ) + h = 1; + ms_buffer = new wxBitmap(w, h); } return ms_buffer;