Pārlūkot izejas kodu

WebGLRenderer: Fix runtime error when rendering wireframes with empty geometry. (#26465)

Michael Herzog 2 gadi atpakaļ
vecāks
revīzija
39305cf483

+ 3 - 0
src/renderers/WebGLRenderer.js

@@ -795,6 +795,9 @@ class WebGLRenderer {
 			if ( material.wireframe === true ) {
 
 				index = geometries.getWireframeAttribute( geometry );
+
+				if ( index === undefined ) return;
+
 				rangeFactor = 2;
 
 			}

+ 5 - 1
src/renderers/webgl/WebGLGeometries.js

@@ -128,7 +128,7 @@ function WebGLGeometries( gl, attributes, info, bindingStates ) {
 
 			}
 
-		} else {
+		} else if ( geometryPosition !== undefined ) {
 
 			const array = geometryPosition.array;
 			version = geometryPosition.version;
@@ -143,6 +143,10 @@ function WebGLGeometries( gl, attributes, info, bindingStates ) {
 
 			}
 
+		} else {
+
+			return;
+
 		}
 
 		const attribute = new ( arrayNeedsUint32( indices ) ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 );