Skip to content

Commit 8aa0c90

Browse files
committedJun 6, 2024··
fix null annotation values
1 parent d27d836 commit 8aa0c90

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed
 

‎gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
kotlin.code.style=official
22

3-
version = 1.0.0
3+
version = 1.0.1
44

55
asmVersion=9.7

‎src/main/kotlin/xyz/wagyourtail/unimined/expect/TransformPlatform.kt

+5-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import org.objectweb.asm.tree.*
55
import xyz.wagyourtail.unimined.expect.utils.toByteArray
66
import java.nio.file.Path
77
import kotlin.io.path.*
8-
8+
import kotlin.math.max
99

1010
class TransformPlatform(val platformName: String) {
1111

@@ -53,11 +53,11 @@ class TransformPlatform(val platformName: String) {
5353
}
5454

5555
@Suppress("UNCHECKED_CAST")
56-
val platforms = annotation.values[1] as List<AnnotationNode>
56+
val platforms = annotation.values[1] as? List<AnnotationNode>
5757

5858
var platformClass: String? = null
5959

60-
for (platform in platforms) {
60+
for (platform in platforms ?: emptyList()) {
6161
val name = platform.values[1] as String
6262
val clazz = platform.values[3] as String
6363
if(name == platformName) {
@@ -86,7 +86,8 @@ class TransformPlatform(val platformName: String) {
8686
)
8787
method.instructions.add(InsnNode(type.returnType.getOpcode(Opcodes.IRETURN)))
8888

89-
method.maxStack = -1
89+
method.maxStack = max(type.returnType.size, stackIndex)
90+
method.maxLocals = stackIndex
9091
}
9192

9293
private fun platformOnly(method: MethodNode, classNode: ClassNode, annotation: AnnotationNode) {

0 commit comments

Comments
 (0)
Please sign in to comment.