Skip to content

Commit 39305cf

Browse files
authored
WebGLRenderer: Fix runtime error when rendering wireframes with empty geometry. (#26465)
1 parent afe58df commit 39305cf

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/renderers/WebGLRenderer.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,9 @@ class WebGLRenderer {
795795
if ( material.wireframe === true ) {
796796

797797
index = geometries.getWireframeAttribute( geometry );
798+
799+
if ( index === undefined ) return;
800+
798801
rangeFactor = 2;
799802

800803
}

src/renderers/webgl/WebGLGeometries.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ function WebGLGeometries( gl, attributes, info, bindingStates ) {
128128

129129
}
130130

131-
} else {
131+
} else if ( geometryPosition !== undefined ) {
132132

133133
const array = geometryPosition.array;
134134
version = geometryPosition.version;
@@ -143,6 +143,10 @@ function WebGLGeometries( gl, attributes, info, bindingStates ) {
143143

144144
}
145145

146+
} else {
147+
148+
return;
149+
146150
}
147151

148152
const attribute = new ( arrayNeedsUint32( indices ) ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 );

0 commit comments

Comments
 (0)