Explorar o código

Fixed null selfValue in FuncValue crash.

Mark Sibly %!s(int64=8) %!d(string=hai) anos
pai
achega
8e449ff3a1
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      src/mx2cc/func.monkey2

+ 4 - 2
src/mx2cc/func.monkey2

@@ -321,9 +321,11 @@ Class FuncValue Extends Value
 			
 		Else If IsMethod
 		
-			If Not instance Throw New SemantEx( "Method '"+ToString()+"' cannot be accessed without an instance" )
+			If Not selfValue Throw New SemantEx( "Self has no type" )
 			
-			If Not instance.type.ExtendsType( selfValue.type )'cscope.ctype )
+			If Not instance Throw New SemantEx( "Method '"+ToString()+"' cannot be accessed without an instance" )
+				
+			If Not instance.type.ExtendsType( selfValue.type )
 				Throw New SemantEx( "Method '"+ToString()+"' cannot be accessed from an instance of a different class" )
 			Endif