ext/bindex/com/gsamokovarov/bindex/SetExceptionBindingsEventHook.java in bindex-0.3.0 vs ext/bindex/com/gsamokovarov/bindex/SetExceptionBindingsEventHook.java in bindex-0.4.0

- old
+ new

@@ -14,8 +14,11 @@ public void eventHandler(ThreadContext context, String eventName, String file, int line, String name, IRubyObject type) { RubyArray bindings = RubyBindingsCollector.collectCurrentFor(context); RubyException exception = (RubyException) context.runtime.getGlobalVariables().get("$!"); - exception.setInstanceVariable("@bindings", bindings); + IRubyObject exceptionBindings = exception.getInstanceVariable("@bindings"); + if (exceptionBindings == null || exceptionBindings.isNil()) { + exception.setInstanceVariable("@bindings", bindings); + } } }