don't try to save invalid image: added a wxCHECK(Ok()) to Save() overloads which didn't already have it
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32539 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1262,6 +1262,8 @@ bool wxImage::SaveFile( const wxString& filename ) const
|
|||||||
bool wxImage::SaveFile( const wxString& filename, int type ) const
|
bool wxImage::SaveFile( const wxString& filename, int type ) const
|
||||||
{
|
{
|
||||||
#if wxUSE_STREAMS
|
#if wxUSE_STREAMS
|
||||||
|
wxCHECK_MSG( Ok(), false, wxT("invalid image") );
|
||||||
|
|
||||||
((wxImage*)this)->SetOption(wxIMAGE_OPTION_FILENAME, filename);
|
((wxImage*)this)->SetOption(wxIMAGE_OPTION_FILENAME, filename);
|
||||||
|
|
||||||
wxFileOutputStream stream(filename);
|
wxFileOutputStream stream(filename);
|
||||||
@@ -1279,6 +1281,8 @@ bool wxImage::SaveFile( const wxString& filename, int type ) const
|
|||||||
bool wxImage::SaveFile( const wxString& filename, const wxString& mimetype ) const
|
bool wxImage::SaveFile( const wxString& filename, const wxString& mimetype ) const
|
||||||
{
|
{
|
||||||
#if wxUSE_STREAMS
|
#if wxUSE_STREAMS
|
||||||
|
wxCHECK_MSG( Ok(), false, wxT("invalid image") );
|
||||||
|
|
||||||
((wxImage*)this)->SetOption(wxIMAGE_OPTION_FILENAME, filename);
|
((wxImage*)this)->SetOption(wxIMAGE_OPTION_FILENAME, filename);
|
||||||
|
|
||||||
wxFileOutputStream stream(filename);
|
wxFileOutputStream stream(filename);
|
||||||
@@ -1428,8 +1432,7 @@ bool wxImage::SaveFile( wxOutputStream& stream, int type ) const
|
|||||||
wxCHECK_MSG( Ok(), false, wxT("invalid image") );
|
wxCHECK_MSG( Ok(), false, wxT("invalid image") );
|
||||||
|
|
||||||
wxImageHandler *handler = FindHandler(type);
|
wxImageHandler *handler = FindHandler(type);
|
||||||
|
if ( !handler )
|
||||||
if (handler == 0)
|
|
||||||
{
|
{
|
||||||
wxLogWarning( _("No image handler for type %d defined."), type );
|
wxLogWarning( _("No image handler for type %d defined."), type );
|
||||||
|
|
||||||
@@ -1444,8 +1447,7 @@ bool wxImage::SaveFile( wxOutputStream& stream, const wxString& mimetype ) const
|
|||||||
wxCHECK_MSG( Ok(), false, wxT("invalid image") );
|
wxCHECK_MSG( Ok(), false, wxT("invalid image") );
|
||||||
|
|
||||||
wxImageHandler *handler = FindHandlerMime(mimetype);
|
wxImageHandler *handler = FindHandlerMime(mimetype);
|
||||||
|
if ( !handler )
|
||||||
if (handler == 0)
|
|
||||||
{
|
{
|
||||||
wxLogWarning( _("No image handler for type %s defined."), mimetype.GetData() );
|
wxLogWarning( _("No image handler for type %s defined."), mimetype.GetData() );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user