fix crash with empty models

This commit is contained in:
Glenn Maynard
2007-02-07 05:54:13 +00:00
parent 8b1c76065e
commit 2cebe3ef34
2 changed files with 8 additions and 7 deletions
+2 -2
View File
@@ -852,8 +852,8 @@ class RageCompiledGeometrySWD3D : public RageCompiledGeometry
public:
void Allocate( const vector<msMesh> &vMeshes )
{
m_vVertex.resize( GetTotalVertices() );
m_vTriangles.resize( GetTotalTriangles() );
m_vVertex.resize( max(1u, GetTotalVertices()) );
m_vTriangles.resize( max(1u, GetTotalTriangles()) );
}
void Change( const vector<msMesh> &vMeshes )
{
+6 -5
View File
@@ -756,11 +756,12 @@ public:
void Allocate( const vector<msMesh> &vMeshes )
{
m_vPosition.resize( GetTotalVertices() );
m_vTexture.resize( GetTotalVertices() );
m_vNormal.resize( GetTotalVertices() );
m_vTexMatrixScale.resize( GetTotalVertices() );
m_vTriangles.resize( GetTotalTriangles() );
/* Always allocate at least 1 entry, so &x[0] is valid. */
m_vPosition.resize( max(1u, GetTotalVertices()) );
m_vTexture.resize( max(1u, GetTotalVertices()) );
m_vNormal.resize( max(1u, GetTotalVertices()) );
m_vTexMatrixScale.resize( max(1u, GetTotalVertices()) );
m_vTriangles.resize( max(1u, GetTotalTriangles()) );
}
void Change( const vector<msMesh> &vMeshes )
{