weimingtom / away3d

Automatically exported from code.google.com/p/away3d
0 stars 1 forks source link

Bug in DefaultScreenPass.as: Dispose fails if there is not normalMapTexture asigned #180

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Here is a patch:

Index: src\away3d\materials\passes\DefaultScreenPass.as
=============================================== 

--- src\away3d\materials\passes\DefaultScreenPass.as     (revision 3200) 
+++ src\away3d\materials\passes\DefaultScreenPass.as     (working copy)
@@ -143,16 +143,16 @@
         * @inheritDoc
         */
        override public function dispose(deep : Boolean) : void
        {
            super.dispose(deep);

-           _normalMapTexture.dispose(deep);
-           _diffuseMethod.dispose(deep);
+           if(_normalMapTexture) _normalMapTexture.dispose(deep);
+           if(_diffuseMethod) _diffuseMethod.dispose(deep);
            if (_shadowMethod) _shadowMethod.dispose(deep);
-           _ambientMethod.dispose(deep);
+           if(_ambientMethod) _ambientMethod.dispose(deep);
            if (_specularMethod) _specularMethod.dispose(deep);
            if (_colorTransformMethod) _colorTransformMethod.dispose(deep);
            for (var i : int = 0; i < _methods.length; ++i)
                _methods[i].dispose(deep);
        }

Original issue reported on code.google.com by rag...@gmail.com on 27 Apr 2011 at 7:45