diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2014-02-18 02:35:09 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2014-02-18 02:38:08 +0400 |
commit | 16c75cf594a92b232e46f922d644ac0a70088bad (patch) | |
tree | f50ed91fe7b7bcaa70bae7e478db35cddb12adfe /source/gameengine/Converter/KX_ConvertActuators.cpp | |
parent | 3d7e0aae52c9d30739a001826c3f6b3331270f36 (diff) |
Fix T38654: Using a non-camera object for the SetCamera Scene Actuator causes a segfault.
Non-camera objects are not supported as cameras, and trying to use them
just causes memory errors (some bad typecasts are involved). When converting
a Scene Actuator, only use the object as a camera if it is actually a camera.
Also, the logic brick UI now filters for camera objects, which should help
avoid confusion.
Diffstat (limited to 'source/gameengine/Converter/KX_ConvertActuators.cpp')
-rw-r--r-- | source/gameengine/Converter/KX_ConvertActuators.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp index 26401fcd868..725e9815a67 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ b/source/gameengine/Converter/KX_ConvertActuators.cpp @@ -758,7 +758,9 @@ void BL_ConvertActuators(const char* maggiename, mode = KX_SceneActuator::KX_SCENE_SET_CAMERA; if (sceneact->camera) { - cam = (KX_Camera*) converter->FindGameObject(sceneact->camera); + KX_GameObject *tmp = converter->FindGameObject(sceneact->camera); + if (tmp && tmp->GetGameObjectType() == SCA_IObject::OBJ_CAMERA) + cam = (KX_Camera*)tmp; } break; case ACT_SCENE_RESTART: |