From fc6fe9acfb3f70d65c97fc45d9d3b0a8b1b16236 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 25 Jan 2016 18:52:20 +0100 Subject: [PATCH] Do not crash ModVertexAlphaVisitor when there are no vertex colors --- apps/openmw/mwrender/sky.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index efe797336..692e3655a 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -374,8 +374,13 @@ public: } else if (mMeshType == 2) { - osg::Vec4Array* origColors = static_cast(geom->getColorArray()); - alpha = ((*origColors)[i].x() == 1.f) ? 1.f : 0.f; + if (geom->getColorArray()) + { + osg::Vec4Array* origColors = static_cast(geom->getColorArray()); + alpha = ((*origColors)[i].x() == 1.f) ? 1.f : 0.f; + } + else + alpha = 1.f; } (*colors)[i] = osg::Vec4f(0.f, 0.f, 0.f, alpha);