Browse Source

Fix crash in PtGetCameraNumber()

Adam Johnson 12 years ago
parent
commit
e86d3a7658
  1. 5
      Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp
  2. 2
      Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp

5
Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp

@ -227,7 +227,10 @@ plVirtualCam1::~plVirtualCam1()
// for saving camera stack // for saving camera stack
plCameraModifier1* plVirtualCam1::GetCameraNumber(size_t camNumber) plCameraModifier1* plVirtualCam1::GetCameraNumber(size_t camNumber)
{ {
return (fCameraStack[camNumber]); if (fCameraStack.size() > camNumber)
return fCameraStack[camNumber];
else
return nil;
} }
// for rebuilding camera stack // for rebuilding camera stack
void plVirtualCam1::RebuildStack(const plKey& key) void plVirtualCam1::RebuildStack(const plKey& key)

2
Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp

@ -2462,7 +2462,7 @@ int cyMisc::GetNumCameras()
const char* cyMisc::GetCameraNumber(int number) const char* cyMisc::GetCameraNumber(int number)
{ {
plCameraModifier1* pCam = plVirtualCam1::Instance()->GetCameraNumber(number-1); plCameraModifier1* pCam = plVirtualCam1::Instance()->GetCameraNumber(number-1);
if (pCam->GetTarget()) if (pCam && pCam->GetTarget())
{ {
const char* ret = pCam->GetTarget()->GetKeyName().c_str(); const char* ret = pCam->GetTarget()->GetKeyName().c_str();
plString str = plString::Format("saving camera named %s to chronicle\n",ret); plString str = plString::Format("saving camera named %s to chronicle\n",ret);

Loading…
Cancel
Save