git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11116 
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
     size_t i;
 
     if ( stream.Read(xpm_buffer, length).LastError() == wxSTREAM_READ_ERROR )
     size_t i;
 
     if ( stream.Read(xpm_buffer, length).LastError() == wxSTREAM_READ_ERROR )
 
     /*
      *  Remove comments from the file:
 
     /*
      *  Remove comments from the file:
+    if ( !lines_cnt )
+    {
+        // this doesn't really look an XPM image
+        return wxNullImage;
+    }
+
     xpm_lines = new const char*[lines_cnt];
     xpm_lines[0] = xpm_buffer;
     line = 1;
     xpm_lines = new const char*[lines_cnt];
     xpm_lines[0] = xpm_buffer;
     line = 1;