Browse Source

Fix renderer crash

Denis Andrasec 1 year ago
parent
commit
63fc9555d7

+ 5 - 5
spine-android/spine-android/src/main/java/com/esotericsoftware/spine/android/SkeletonRenderer.java

@@ -203,6 +203,11 @@ public class SkeletonRenderer {
 		}
 		}
 		clipper.clipEnd();
 		clipper.clipEnd();
 
 
+		if (commandList.size == 1 && commandList.get(0).vertices.size == 0) {
+			commandPool.freeAll(commandList);
+			commandList.clear();
+		}
+
 		return commandList;
 		return commandList;
 	}
 	}
 
 
@@ -210,11 +215,6 @@ public class SkeletonRenderer {
 		for (int i = 0; i < commands.size; i++) {
 		for (int i = 0; i < commands.size; i++) {
 			RenderCommand command = commands.get(i);
 			RenderCommand command = commands.get(i);
 
 
-			// TODO: Happens when deselecting last skin in DressUp sample
-			if (command.texture == null) {
-				break;
-			}
-
 			canvas.drawVertices(Canvas.VertexMode.TRIANGLES, command.vertices.size, command.vertices.items, 0, command.uvs.items, 0,
 			canvas.drawVertices(Canvas.VertexMode.TRIANGLES, command.vertices.size, command.vertices.items, 0, command.uvs.items, 0,
 				command.colors.items, 0, command.indices.items, 0, command.indices.size, command.texture.getPaint(command.blendMode));
 				command.colors.items, 0, command.indices.items, 0, command.indices.size, command.texture.getPaint(command.blendMode));
 		}
 		}