Skip to content

Commit

Permalink
在 material 被销毁的情况下,防止报错 (cocos#7639)
Browse files Browse the repository at this point in the history
  • Loading branch information
VisualSJ authored Oct 30, 2020
1 parent 65a1cf4 commit a79b3f6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cocos/core/3d/framework/mesh-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,10 @@ export class MeshRenderer extends RenderableComponent {
const renderingMesh = this._mesh.renderingSubMeshes;
if (renderingMesh) {
for (let i = 0; i < meshCount; ++i) {
const material = this.getRenderMaterial(i);
let material = this.getRenderMaterial(i);
if (material && !material.isValid) {
material = null;
}
const subMeshData = renderingMesh[i];
if (subMeshData) {
this._model.initSubModel(i, subMeshData, material || this._getBuiltinMaterial());
Expand Down

0 comments on commit a79b3f6

Please sign in to comment.