From 5ffea55bccbb46282a6c4bb12c60ac1e1853e8c8 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 31 Jul 2014 19:50:25 +0200 Subject: [PATCH] Crash workaround in IG loading, ref #171 --- code/nel/src/3d/scene_group.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/code/nel/src/3d/scene_group.cpp b/code/nel/src/3d/scene_group.cpp index d539278cd..fa67230d4 100644 --- a/code/nel/src/3d/scene_group.cpp +++ b/code/nel/src/3d/scene_group.cpp @@ -753,7 +753,13 @@ bool CInstanceGroup::addToSceneWhenAllShapesLoaded (CScene& scene, IDriver *driv { _Instances[i]->clipUnlinkFromAll(); for (j = 0; j < _InstancesInfos[i].Clusters.size(); ++j) - _ClusterInstances[_InstancesInfos[i].Clusters[j]]->clipAddChild( _Instances[i] ); + { + uint32 clusterInst = _InstancesInfos[i].Clusters[j]; + if (clusterInst < _ClusterInstances.size()) + _ClusterInstances[clusterInst]->clipAddChild( _Instances[i] ); + else + nlwarning("IG: BUG: Cluster infos size %u, indexing %u", (uint32)_ClusterInstances.size(), clusterInst); + } // For the first time we have to set all the instances to NOT move (and not be rebinded) _Instances[i]->freeze(); _Instances[i]->setClusterSystem (this);