diff options
author | John Shahid <jvshahid@gmail.com> | 2013-01-15 07:59:24 -0500 |
---|---|---|
committer | Florian Frank <flori@ping.de> | 2013-02-04 23:48:51 +0100 |
commit | 241622f2a78f17ec9ed86cac992a44926e7a1133 (patch) | |
tree | 48679810ee1d414f4b44bad98d42380428979f3a /java | |
parent | d7b18ba149400971a1415468fd865f8d4794d789 (diff) | |
download | json-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.java | 3 |
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; } } |