From c0438a0c6ba18f72ae815e7046ad36d6f00434d7 Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Mon, 26 Aug 2019 22:59:51 +0300 Subject: [PATCH] Avoid using getPtr on empty geometry data --- components/nifosg/nifloader.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index e199a3b72..568286a4d 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -1072,8 +1072,9 @@ namespace NifOsg if (nifNode->recType == Nif::RC_NiTriShape) { const Nif::NiTriShape* triShape = static_cast(nifNode); - if (const Nif::NiTriShapeData* data = triShape->data.getPtr()) + if (!triShape->data.empty()) { + const Nif::NiTriShapeData* data = triShape->data.getPtr(); vertexColorsPresent = !data->colors.empty(); triCommonToGeometry(geometry, data->vertices, data->normals, data->uvlist, data->colors, boundTextures, triShape->name); if (!data->triangles.empty()) @@ -1084,8 +1085,9 @@ namespace NifOsg else { const Nif::NiTriStrips* triStrips = static_cast(nifNode); - if (const Nif::NiTriStripsData* data = triStrips->data.getPtr()) + if (!triStrips->data.empty()) { + const Nif::NiTriStripsData* data = triStrips->data.getPtr(); vertexColorsPresent = !data->colors.empty(); triCommonToGeometry(geometry, data->vertices, data->normals, data->uvlist, data->colors, boundTextures, triStrips->name); if (!data->strips.empty())