]> git.saurik.com Git - wxWidgets.git/commitdiff
Checked for stream validity in wxImage::GetImageCount.
authorJulian Smart <julian@anthemion.co.uk>
Thu, 5 Dec 2002 10:19:00 +0000 (10:19 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 5 Dec 2002 10:19:00 +0000 (10:19 +0000)
use horse3.ani in image sample.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18049 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/image/image.cpp
src/common/image.cpp

index d2e29245245b09346a461bfcabea18ff7f5cae45..9fa7e32efe89c4460a7c9d86a2f5f61f8decc9bc 100644 (file)
@@ -423,7 +423,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
         yH = 2420 + image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y) ;
     }
 
         yH = 2420 + image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y) ;
     }
 
-    m_ani_images = wxImage::GetImageCount ( dir + _T("horse.ani"), wxBITMAP_TYPE_ANI );
+    m_ani_images = wxImage::GetImageCount ( dir + _T("horse3.ani"), wxBITMAP_TYPE_ANI );
     if (m_ani_images==0)
         wxLogError(wxT("No ANI-format images found"));
     else
     if (m_ani_images==0)
         wxLogError(wxT("No ANI-format images found"));
     else
@@ -432,7 +432,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
     for (i=0; i < m_ani_images; i++)
     {
         image.Destroy();
     for (i=0; i < m_ani_images; i++)
     {
         image.Destroy();
-        if (!image.LoadFile( dir + _T("horse.ani"), wxBITMAP_TYPE_ANI, i ))
+        if (!image.LoadFile( dir + _T("horse3.ani"), wxBITMAP_TYPE_ANI, i ))
         {
             wxString tmp = wxT("Can't load image number ");
             tmp << i ;
         {
             wxString tmp = wxT("Can't load image number ");
             tmp << i ;
index 08b7f9c4d8c8c3e73299618214713250626945d0..3e922fad22a8300f29bd981bd7a405e46b067837 100644 (file)
@@ -1005,7 +1005,10 @@ int wxImage::GetImageCount( const wxString &name, long type )
 {
 #if wxUSE_STREAMS
   wxFileInputStream stream(name);
 {
 #if wxUSE_STREAMS
   wxFileInputStream stream(name);
-  return GetImageCount(stream, type);
+  if (!stream.Ok())
+      return 0;
+  else
+      return GetImageCount(stream, type);
 #else
   return 0;
 #endif
 #else
   return 0;
 #endif