Permalink
Browse files

use contains to detect var in context

  • Loading branch information...
shenfeng committed Dec 27, 2012
1 parent d412b9c commit fbb9f7fd79bc8e9792390df703a192fd189d8331
Showing with 4 additions and 5 deletions.
  1. +1 −1 project.clj
  2. +3 −4 src/java/me/shenfeng/mustache/Context.java
View
@@ -1,4 +1,4 @@
-(defproject me.shenfeng/mustache "1.1"
+(defproject me.shenfeng/mustache "1.2-SNAPSHOT"
:description "Mustache write in java, for clojure"
:dependencies [[org.clojure/clojure "1.4.0"]]
:warn-on-reflection true
@@ -52,14 +52,13 @@ public Object lookup(Object key) {
Object d = context.data;
if (d instanceof Map) {
@SuppressWarnings("rawtypes")
- Object val = ((Map) d).get(key);
- if (val != null) {
- return val;
+ Map m = (Map)d;
+ if(m.containsKey(key)) {
+ return m.get(key);
}
}
context = context.parent;
}
-
return null;
}
}

0 comments on commit fbb9f7f

Please sign in to comment.