CIrrMeshFileLoader::readMeshBuffer avoid accessing pointer before it's not 0 check.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6391 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2022-05-13 14:20:41 +00:00
parent dd7020c27b
commit cc9edcb973

View File

@ -276,13 +276,13 @@ void CIrrMeshFileLoader::readIndices(io::IXMLReader* reader, int indexCount, IIn
void CIrrMeshFileLoader::readMeshBuffer(io::IXMLReader* reader, int vertexCount, CDynamicMeshBuffer* sbuffer) void CIrrMeshFileLoader::readMeshBuffer(io::IXMLReader* reader, int vertexCount, CDynamicMeshBuffer* sbuffer)
{ {
core::stringc data = reader->getNodeData();
const c8* p = &data[0];
scene::IVertexBuffer& Vertices = sbuffer->getVertexBuffer();
video::E_VERTEX_TYPE vType = Vertices.getType();
if (sbuffer) if (sbuffer)
{ {
core::stringc data = reader->getNodeData();
const c8* p = &data[0];
scene::IVertexBuffer& Vertices = sbuffer->getVertexBuffer();
video::E_VERTEX_TYPE vType = Vertices.getType();
for (int i=0; i<vertexCount && *p; ++i) for (int i=0; i<vertexCount && *p; ++i)
{ {
switch(vType) switch(vType)