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:
Vadim Zeitlin
2005-03-01 17:42:28 +00:00
parent 96ed08f775
commit 2a7367398e

View File

@@ -1262,6 +1262,8 @@ bool wxImage::SaveFile( const wxString& filename ) const
bool wxImage::SaveFile( const wxString& filename, int type ) const
{
#if wxUSE_STREAMS
wxCHECK_MSG( Ok(), false, wxT("invalid image") );
((wxImage*)this)->SetOption(wxIMAGE_OPTION_FILENAME, 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
{
#if wxUSE_STREAMS
wxCHECK_MSG( Ok(), false, wxT("invalid image") );
((wxImage*)this)->SetOption(wxIMAGE_OPTION_FILENAME, filename);
wxFileOutputStream stream(filename);
@@ -1428,8 +1432,7 @@ bool wxImage::SaveFile( wxOutputStream& stream, int type ) const
wxCHECK_MSG( Ok(), false, wxT("invalid image") );
wxImageHandler *handler = FindHandler(type);
if (handler == 0)
if ( !handler )
{
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") );
wxImageHandler *handler = FindHandlerMime(mimetype);
if (handler == 0)
if ( !handler )
{
wxLogWarning( _("No image handler for type %s defined."), mimetype.GetData() );