diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-04-05 18:01:49 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-04-05 18:01:49 +0400 |
commit | 033a63f8580227582a9695ebdd78ac0b4322e867 (patch) | |
tree | 61517f343a2908f894d54c46269baa5c54338135 /source/gameengine/Ketsji/KX_PolygonMaterial.cpp | |
parent | 7d4dc4f0f5d34d91703b2219323ef4a3db28a572 (diff) |
BGE Bugfixes (mostly in the py api)
KX_PolygonMaterial and KX_BlenderMaterial - Added a print function (would raise a python error on printing)
* Crashes *
KX_GameObject SetParent - Disallowed setting a parent to its self, caused a recursion crash.
KX_MeshProxy "materials" attribute was segfaulting because of my recent change - I was wrong, you do need to check material types (no idea why since they are both PyObject * at the base)
KX_VisibilityActuator - Wasn't initialized with PyType_Ready() making it crash on access (own fault)
* Crashes because of missing NULL checks *
KX_PolygonMaterial's "gl_texture" attribute wasnt checking for a valid m_tface
KX_GameObject - added checks for GetPhysicsController()
KX_RayCast::RayTest - didnt check for a valid physics_environment
KX_SceneActuator's getCamera python function wasnt checking if there was a camera.
Diffstat (limited to 'source/gameengine/Ketsji/KX_PolygonMaterial.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_PolygonMaterial.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp index c5bddd6d166..3975189a9c2 100644 --- a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp +++ b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp @@ -333,8 +333,11 @@ PyObject* KX_PolygonMaterial::pyattr_get_tface(void *self_v, const KX_PYATTRIBUT PyObject* KX_PolygonMaterial::pyattr_get_gl_texture(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { KX_PolygonMaterial* self= static_cast<KX_PolygonMaterial*>(self_v); - Image *ima = self->m_tface->tpage; - return PyInt_FromLong(ima ? ima->bindcode:0); + int bindcode= 0; + if (self->m_tface && self->m_tface->tpage) + bindcode= self->m_tface->tpage->bindcode; + + return PyInt_FromLong(bindcode); } |