Skip to content

Commit

Permalink
fix null annotation values
Browse files Browse the repository at this point in the history
  • Loading branch information
wagyourtail committed Jun 6, 2024
1 parent d27d836 commit 8aa0c90
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
kotlin.code.style=official

version = 1.0.0
version = 1.0.1

asmVersion=9.7
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.objectweb.asm.tree.*
import xyz.wagyourtail.unimined.expect.utils.toByteArray
import java.nio.file.Path
import kotlin.io.path.*

import kotlin.math.max

class TransformPlatform(val platformName: String) {

Expand Down Expand Up @@ -53,11 +53,11 @@ class TransformPlatform(val platformName: String) {
}

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

var platformClass: String? = null

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

method.maxStack = -1
method.maxStack = max(type.returnType.size, stackIndex)
method.maxLocals = stackIndex
}

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

0 comments on commit 8aa0c90

Please sign in to comment.