소스 검색

[java/cs] Do not fail when passing null values to Reflect.compare

Caue Waneck 12 년 전
부모
커밋
d1e141c97c
2개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      std/cs/internal/Runtime.hx
  2. 2 0
      std/java/internal/Runtime.hx

+ 3 - 0
std/cs/internal/Runtime.hx

@@ -182,6 +182,9 @@ import cs.system.Type;
 	}
 
 	@:functionCode('
+			if (v1 == v2) return 0;
+			if (v1 == null) return -1;
+			if (v2 == null) return 1;
 			System.IConvertible cv1 = v1 as System.IConvertible;
 			if (cv1 != null)
 			{

+ 2 - 0
std/java/internal/Runtime.hx

@@ -211,6 +211,8 @@ package java.internal;
 	@:functionCode('
 			if (v1 == v2)
 				return 0;
+			if (v1 == null) return -1;
+			if (v2 == null) return 1;
 
 			if (v1 instanceof java.lang.Number || v2 instanceof java.lang.Number)
 			{