浏览代码

Fixed null selfValue in FuncValue crash.

Mark Sibly 8 年之前
父节点
当前提交
8e449ff3a1
共有 1 个文件被更改,包括 4 次插入2 次删除
  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