diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-09-06 05:18:53 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-09-06 05:18:53 +0400 |
commit | e279aadb9721d881167bd978a44a3408c8578def (patch) | |
tree | bbef0c685203b627a950c473c665e9380c4a9e08 /source/gameengine/Rasterizer/RAS_MaterialBucket.cpp | |
parent | 61e628365741089967db17f0cfc02cf059dfb9e4 (diff) |
Bugfix: game engine could crash with empty display arrays on
windows (caused by invisible faces for example).
Diffstat (limited to 'source/gameengine/Rasterizer/RAS_MaterialBucket.cpp')
-rw-r--r-- | source/gameengine/Rasterizer/RAS_MaterialBucket.cpp | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp index e003cdc9368..69a8271d3e8 100644 --- a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp +++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp @@ -131,19 +131,29 @@ void RAS_MeshSlot::begin(RAS_MeshSlot::iterator& it) int startvertex, endvertex; int startindex, endindex; - it.array = m_displayArrays[m_startarray]; - - startvertex = m_startvertex; - endvertex = (m_startarray == m_endarray)? m_endvertex: it.array->m_vertex.size(); - startindex = m_startindex; - endindex = (m_startarray == m_endarray)? m_endindex: it.array->m_index.size(); - - it.vertex = &it.array->m_vertex[0]; - it.index = &it.array->m_index[startindex]; - it.startvertex = startvertex; - it.endvertex = endvertex; - it.totindex = endindex-startindex; - it.arraynum = m_startarray; + it.array = (m_displayArrays.size() > 0)? m_displayArrays[m_startarray]: NULL; + + if(it.array == NULL || it.array->m_index.size() == 0 || it.array->m_vertex.size() == 0) { + it.array = NULL; + it.vertex = NULL; + it.index = NULL; + it.startvertex = 0; + it.endvertex = 0; + it.totindex = 0; + } + else { + startvertex = m_startvertex; + endvertex = (m_startarray == m_endarray)? m_endvertex: it.array->m_vertex.size(); + startindex = m_startindex; + endindex = (m_startarray == m_endarray)? m_endindex: it.array->m_index.size(); + + it.vertex = &it.array->m_vertex[0]; + it.index = &it.array->m_index[startindex]; + it.startvertex = startvertex; + it.endvertex = endvertex; + it.totindex = endindex-startindex; + it.arraynum = m_startarray; + } } void RAS_MeshSlot::next(RAS_MeshSlot::iterator& it) |