fix for opencollada crash with r40164, missing NULL check.
authorCampbell Barton <ideasman42@gmail.com>
Mon, 12 Sep 2011 13:59:23 +0000 (13:59 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 12 Sep 2011 13:59:23 +0000 (13:59 +0000)
source/blender/collada/EffectExporter.cpp

index b4cc88ee3b87f78d81a4e0cb25c015dd6424fa49..6863e26a3ce92c3214819485c0a0509662d15cc0 100644 (file)
@@ -178,7 +178,11 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
 
        // ambient
        /* ma->ambX is calculated only on render, so lets do it here manually and not rely on ma->ambX. */
-       cot = getcol(this->scene->world->ambr*ma->amb, this->scene->world->ambg*ma->amb, this->scene->world->ambb*ma->amb, 1.0f);
+       if(this->scene->world)
+               cot = getcol(this->scene->world->ambr*ma->amb, this->scene->world->ambg*ma->amb, this->scene->world->ambb*ma->amb, 1.0f);
+       else
+               cot = getcol(ma->amb, ma->amb, ma->amb, 1.0f);
+
        ep.setAmbient(cot, false , "ambient");
 
        // reflective, reflectivity