test whether pointer is non-NULL before using it, not after, in wxAnimation::Load() (thanks coverity)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45145 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-03-30 13:43:31 +00:00
parent 26564cf29d
commit ba5787676d

View File

@@ -147,10 +147,6 @@ bool wxAnimation::Load(wxInputStream &stream, wxAnimationType type)
handler = FindHandler(type);
// do a copy of the handler from the static list which we will own
// as our reference data
m_refData = handler->Clone();
if (handler == NULL)
{
wxLogWarning( _("No animation handler for type %ld defined."), type );
@@ -158,6 +154,11 @@ bool wxAnimation::Load(wxInputStream &stream, wxAnimationType type)
return false;
}
// do a copy of the handler from the static list which we will own
// as our reference data
m_refData = handler->Clone();
if (stream.IsSeekable() && !M_ANIMDATA->CanRead(stream))
{
wxLogError(_("Animation file is not of type %ld."), type);