mirror of
				https://github.com/GayPizzaSpecifications/pork.git
				synced 2025-11-03 17:39:38 +00:00 
			
		
		
		
	ffi: ensure failure to find functions don't produce null pointer exceptions
This commit is contained in:
		@ -10,6 +10,7 @@ class JnaNativeProvider : NativeProvider {
 | 
				
			|||||||
  override fun provideNativeFunction(definition: String, arguments: List<ArgumentSpec>): CallableFunction {
 | 
					  override fun provideNativeFunction(definition: String, arguments: List<ArgumentSpec>): CallableFunction {
 | 
				
			||||||
    val functionDefinition = FfiFunctionDefinition.parse(definition)
 | 
					    val functionDefinition = FfiFunctionDefinition.parse(definition)
 | 
				
			||||||
    val function = Function.getFunction(functionDefinition.library, functionDefinition.function)
 | 
					    val function = Function.getFunction(functionDefinition.library, functionDefinition.function)
 | 
				
			||||||
 | 
					      ?: throw RuntimeException("Failed to find function ${functionDefinition.function} in library ${functionDefinition.library}")
 | 
				
			||||||
    return CallableFunction { functionArgs ->
 | 
					    return CallableFunction { functionArgs ->
 | 
				
			||||||
      val ffiArgs = mutableListOf<Any?>()
 | 
					      val ffiArgs = mutableListOf<Any?>()
 | 
				
			||||||
      for ((index, spec) in arguments.withIndex()) {
 | 
					      for ((index, spec) in arguments.withIndex()) {
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user