changeset 12452:5f022aa41631

Truffle-DSL: fixed an NPE if invalid TypeData are compared.
author Christian Humer <christian.humer@gmail.com>
date Wed, 16 Oct 2013 18:25:16 +0200
parents 47eb670c1634
children 8970574702a4
files graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/typesystem/ImplicitCastData.java
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/typesystem/ImplicitCastData.java	Mon Oct 14 18:48:21 2013 +0200
+++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/typesystem/ImplicitCastData.java	Wed Oct 16 18:25:16 2013 +0200
@@ -45,13 +45,14 @@
 
     @Override
     public int compareTo(TemplateMethod o) {
-        if (o instanceof ImplicitCastData) {
+        if (o instanceof ImplicitCastData && sourceType != null) {
             // implicit casts are ordered by source type since
             // its also the order in which they are checked.
             TypeData otherSourceType = ((ImplicitCastData) o).getSourceType();
-            return this.sourceType.compareTo(otherSourceType);
+            if (otherSourceType != null) {
+                return this.sourceType.compareTo(otherSourceType);
+            }
         }
         return super.compareTo(o);
     }
-
 }