|
@@ -175,6 +175,10 @@ void Discreet3DSImporter::InternReadFile( const std::string& pFile,
|
|
|
// file.
|
|
|
for (std::vector<D3DS::Mesh>::iterator i = mScene->mMeshes.begin(),
|
|
|
end = mScene->mMeshes.end(); i != end;++i) {
|
|
|
+ if ((*i).mFaces.size() > 0 && (*i).mPositions.size() == 0) {
|
|
|
+ delete mScene;
|
|
|
+ throw DeadlyImportError("3DS file contains faces but no vertices: " + pFile);
|
|
|
+ }
|
|
|
CheckIndices(*i);
|
|
|
MakeUnique (*i);
|
|
|
ComputeNormalsWithSmoothingsGroups<D3DS::Face>(*i);
|
|
@@ -944,6 +948,9 @@ void Discreet3DSImporter::ParseFaceChunk()
|
|
|
// This is the list of smoothing groups - a bitfield for every face.
|
|
|
// Up to 32 smoothing groups assigned to a single face.
|
|
|
unsigned int num = chunkSize/4, m = 0;
|
|
|
+ if (num > mMesh.mFaces.size()) {
|
|
|
+ throw DeadlyImportError("3DS: More smoothing groups than faces");
|
|
|
+ }
|
|
|
for (std::vector<D3DS::Face>::iterator i = mMesh.mFaces.begin(); m != num;++i, ++m) {
|
|
|
// nth bit is set for nth smoothing group
|
|
|
(*i).iSmoothGroup = stream->GetI4();
|