Advertisement

Its late and i need some help

Started by April 16, 2002 10:53 PM
1 comment, last by llvllatrix 22 years, 10 months ago
Anyone know why this code is giving an illegal opperation? It compiles but when i try to the program it crashes. //Loop through each point of a triangle for (int k = 0; k < 3; k++) { //Start at the top of the vertex list VertexList * pVertCurrent = pCollisionGroupsCurrent->pVertFirst; int l = 0; while(1) { if (pVertCurrent->m_location == m_pVertices[m_pTriangles[pTriangleIndices[j]].m_vertexIndices[k]].m_location) { break; } //End of the lsit if (pVertCurrent == NULL) { pVertCurrent = new(VertexList); pVertCurrent->m_location[0] = m_pVertices[m_pTriangles[pTriangleIndices[j]].m_vertexIndices[k]].m_location[0]; pVertCurrent->m_location[1] = m_pVertices[m_pTriangles[pTriangleIndices[j]].m_vertexIndices[k]].m_location[1]; pVertCurrent->m_location[2] = m_pVertices[m_pTriangles[pTriangleIndices[j]].m_vertexIndices[k]].m_location[2]; break; } ********** //compiler says there is someting wrong here //something about an access violation pVertCurrent = pVertCurrent->pNext; l++; } Sorry bout the mess. Help much appreciated.
quote:
if (pVertCurrent->m_location == m_pVertices[m_pTriangles[pTriangleIndices[j]].m_vertexIndices[k]].m_location)
{
break;
}

You are using the pointer before checking to see if it is NULL.
Hope this helps

---------------

#define TRUE 0
#define FALSE 1
//MUAHAHAHAHAAAA!
Advertisement
yep, that was it. Thanks.

This topic is closed to new replies.

Advertisement