Index: orxonox/trunk/src/lib/graphics/importer/model.cc
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/model.cc	(revision 4105)
+++ orxonox/trunk/src/lib/graphics/importer/model.cc	(revision 4106)
@@ -140,4 +140,7 @@
   this->currentGroup = this->firstGroup = new ModelGroup;
   this->groupCount = 0;
+  this->vertexCount = 0;
+  this->normalCount = 0;
+  this->texCoordCount = 0;
   
   this->scaleFactor = 1;
@@ -355,5 +358,4 @@
 Material* Model::addMaterial(const char* materialName)
 {
-  
   Material* newMat = new Material();
   newMat->setName(materialName);
@@ -424,4 +426,5 @@
   PRINTF(5)("reading in a vertex: %f %f %f\n", &subbuffer1, &subbuffer2, &subbuffer3);
   this->vertices->addEntry(subbuffer1*scaleFactor, subbuffer2*scaleFactor, subbuffer3*scaleFactor);
+  this->vertexCount++;
   return true;
 }
@@ -438,4 +441,5 @@
   PRINTF(5)("reading in a vertex: %f %f %f\n", x, y, z);
   this->vertices->addEntry(x*scaleFactor, y*scaleFactor, z*scaleFactor);
+  this->vertexCount++;
   return true;
 }
@@ -455,4 +459,5 @@
   PRINTF(5)("found vertex-Normal %f, %f, %f\n", &subbuffer1,&subbuffer2,&subbuffer3);
   this->normals->addEntry(subbuffer1, subbuffer2, subbuffer3);
+  this->normalCount++;
   return true;
 }
@@ -470,4 +475,6 @@
   PRINTF(5)("found vertex-Normal %f, %f, %f\n", x, y, z);
   this->normals->addEntry(x, y, z);
+  this->normalCount++;
+  return true;
 }
 
@@ -487,4 +494,5 @@
   this->vTexture->addEntry(subbuffer1);
   this->vTexture->addEntry(subbuffer2);
+  this->texCoordCount++;
   return true;
 }
@@ -502,4 +510,6 @@
   this->vTexture->addEntry(u);
   this->vTexture->addEntry(v);
+  this->texCoordCount++;
+  return true;
 }
 
@@ -583,5 +593,5 @@
   for (int i = 0; i < faceElemCount; i++)
     {
-      if (this->currentGroup->currentFace->vertexCount>0)
+      if (this->currentGroup->currentFace->vertexCount > 0)
 	tmpElem = tmpElem->next = new ModelFaceElement;
 
@@ -592,4 +602,11 @@
  	tmpElem->normalNumber = va_arg(itemlist, int) -1;
       this->currentGroup->currentFace->vertexCount++;
+
+      if (unlikely(tmpElem->vertexNumber > this->vertexCount))
+	PRINTF(1)("VERTEX %d IS NOT IN THE LIST -> DANGER OF SEGFAULT (max is: %d)\n", tmpElem->vertexNumber, this->vertexCount);
+      if (unlikely(tmpElem->normalNumber > this->normalCount))
+	PRINTF(1)("VERTEX %d IS NOT IN THE LIST -> DANGER OF SEGFAULT (max is: %d)\n", tmpElem->normalNumber, this->normalCount);
+      if (unlikely(tmpElem->texCoordNumber > this->texCoordCount))
+	PRINTF(1)("VERTEX %d IS NOT IN THE LIST -> DANGER OF SEGFAULT (max is: %d)\n", tmpElem->texCoordNumber, this->texCoordCount);
     }
   va_end(itemlist);
Index: orxonox/trunk/src/lib/graphics/importer/model.h
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/model.h	(revision 4105)
+++ orxonox/trunk/src/lib/graphics/importer/model.h	(revision 4106)
@@ -99,6 +99,8 @@
   bool finalized;             //!< Sets the Object to be finalized.
 
+  int vertexCount;            //!< A modelwide Counter for vertices.
+  int normalCount;            //!< A modelwide Counter for the normals.
+  int texCoordCount;          //!< A modelwide Counter for the texCoord.
   Array* vertices;            //!< The Array that handles the Vertices.
-  int verticesCount;          //!< A global Counter for vertices.
   Array* normals;             //!< The Array that handles the Normals.
   Array* vTexture;            //!< The Array that handles the VertexTextureCoordinates.
@@ -158,4 +160,11 @@
   bool setMaterial(Material* mtl);
   void finalize(void);
+
+  /** \returns The number of Vertices of the Model */
+  inline int getVertexCount(void) const {return this->vertexCount;}
+  /** \returns The number of Normals of the Model */
+  inline int getNormalCount(void) const {return this->normalCount;}
+  /** \returns The number of Texture Coordinates of the Model*/
+  inline int getTexCoordCount(void) const {return this->texCoordCount;}
 };
 
