Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-03-23 15:37:08 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-03-23 15:40:30 +0300
commit6e31f4f0900d07e1b54facc0127e1fd01c65a1c1 (patch)
tree61a7d312fea484b9419c3b29688a71caaf81bf2d /source/gameengine
parent74399e0a18c58a3e424471b2670189102ab76a60 (diff)
Fix T47893: BGE crashes w/ generated mesh data
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsController.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
index 89806d80ea9..c79e1c23ef6 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
@@ -1895,10 +1895,10 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject *meshobj, DerivedMesh *dm,
for (int p2 = 0; p2 < numpolys; p2++) {
MFace *mf = &mface[p2];
const int origi = index_mf_to_mpoly ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, p2) : p2;
- RAS_Polygon *poly = meshobj->GetPolygon(origi);
+ RAS_Polygon *poly = (origi != ORIGINDEX_NONE) ? meshobj->GetPolygon(origi) : NULL;
// only add polygons that have the collision flag set
- if (poly->IsCollider()) {
+ if (poly && poly->IsCollider()) {
if (!vert_tag_array[mf->v1]) {
vert_tag_array[mf->v1] = true;
tot_bt_verts++;
@@ -1930,7 +1930,7 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject *meshobj, DerivedMesh *dm,
for (int p2 = 0; p2 < numpolys; p2++) {
MFace *mf = &mface[p2];
const int origi = index_mf_to_mpoly ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, p2) : p2;
- RAS_Polygon *poly = meshobj->GetPolygon(origi);
+ RAS_Polygon *poly = (origi != ORIGINDEX_NONE) ? meshobj->GetPolygon(origi) : NULL;
// only add polygons that have the collisionflag set
if (poly->IsCollider()) {
@@ -1973,10 +1973,10 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject *meshobj, DerivedMesh *dm,
for (int p2 = 0; p2 < numpolys; p2++) {
MFace *mf = &mface[p2];
const int origi = index_mf_to_mpoly ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, p2) : p2;
- RAS_Polygon *poly = meshobj->GetPolygon(origi);
+ RAS_Polygon *poly = (origi != ORIGINDEX_NONE) ? meshobj->GetPolygon(origi) : NULL;
// only add polygons that have the collision flag set
- if (poly->IsCollider()) {
+ if (poly && poly->IsCollider()) {
if (!vert_tag_array[mf->v1]) {
vert_tag_array[mf->v1] = true;
vert_remap_array[mf->v1] = tot_bt_verts;
@@ -2025,10 +2025,10 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject *meshobj, DerivedMesh *dm,
MFace *mf = &mface[p2];
MTFace *tf = (tface) ? &tface[p2] : NULL;
const int origi = index_mf_to_mpoly ? DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, p2) : p2;
- RAS_Polygon *poly = meshobj->GetPolygon(origi);
+ RAS_Polygon *poly = (origi != ORIGINDEX_NONE) ? meshobj->GetPolygon(origi) : NULL;
// only add polygons that have the collisionflag set
- if (poly->IsCollider()) {
+ if (poly && poly->IsCollider()) {
MVert *v1 = &mvert[mf->v1];
MVert *v2 = &mvert[mf->v2];
MVert *v3 = &mvert[mf->v3];