summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorJohn Shahid <jvshahid@gmail.com>2013-01-15 07:59:24 -0500
committerFlorian Frank <flori@ping.de>2013-02-04 23:48:51 +0100
commit241622f2a78f17ec9ed86cac992a44926e7a1133 (patch)
tree48679810ee1d414f4b44bad98d42380428979f3a /java
parentd7b18ba149400971a1415468fd865f8d4794d789 (diff)
downloadjson-241622f2a78f17ec9ed86cac992a44926e7a1133.tar.gz
fix a bug in the JRuby implementation. getInstanceVariable() can return a null which causes NPE.
Diffstat (limited to 'java')
-rw-r--r--java/src/json/ext/GeneratorState.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/java/src/json/ext/GeneratorState.java b/java/src/json/ext/GeneratorState.java
index 658d6d0..3065307 100644
--- a/java/src/json/ext/GeneratorState.java
+++ b/java/src/json/ext/GeneratorState.java
@@ -263,7 +263,8 @@ public class GeneratorState extends RubyObject {
if (getMetaClass().isMethodBound(name, true)) {
return send(context, vName, Block.NULL_BLOCK);
} else {
- return getInstanceVariables().getInstanceVariable("@" + name);
+ IRubyObject value = getInstanceVariables().getInstanceVariable("@" + name);
+ return value == null ? context.nil : value;
}
}