Pārlūkot izejas kodu

[libgdx] Fixed NPE when a mesh has no region.

NathanSweet 6 gadi atpakaļ
vecāks
revīzija
51d6681db4

+ 5 - 1
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/MeshAttachment.java

@@ -75,8 +75,10 @@ public class MeshAttachment extends VertexAttachment {
 		if (this.uvs == null || this.uvs.length != regionUVs.length) this.uvs = new float[regionUVs.length];
 		float[] uvs = this.uvs;
 		int n = uvs.length;
-		float u = region.getU(), v = region.getV(), width, height;
+		float u, v, width, height;
 		if (region instanceof AtlasRegion) {
+			u = region.getU();
+			v = region.getV();
 			AtlasRegion region = (AtlasRegion)this.region;
 			float textureWidth = region.getTexture().getWidth(), textureHeight = region.getTexture().getHeight();
 			switch (region.degrees) {
@@ -119,6 +121,8 @@ public class MeshAttachment extends VertexAttachment {
 			u = v = 0;
 			width = height = 1;
 		} else {
+			u = region.getU();
+			v = region.getV();
 			width = region.getU2() - u;
 			height = region.getV2() - v;
 		}