Skip to content

Commit

Permalink
Fix broken argument logic in trace_var and untrace_var.
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Jan 23, 2012
1 parent ee76718 commit 7452ad4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/org/jruby/RubyKernel.java
Expand Up @@ -1235,9 +1235,8 @@ public static IRubyObject set_trace_func(ThreadContext context, IRubyObject recv

@JRubyMethod(required = 1, optional = 1, module = true, visibility = PRIVATE)
public static IRubyObject trace_var(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) {
if (args.length == 0) throw context.getRuntime().newArgumentError(0, 1);
RubyProc proc = null;
String var = args.length > 1 ? args[0].toString() : null;
String var = args[0].toString();
// ignore if it's not a global var
if (var.charAt(0) != '$') return context.getRuntime().getNil();
if (args.length == 1) proc = RubyProc.newProc(context.getRuntime(), block, Block.Type.PROC);
Expand All @@ -1253,7 +1252,7 @@ public static IRubyObject trace_var(ThreadContext context, IRubyObject recv, IRu
@JRubyMethod(required = 1, optional = 1, module = true, visibility = PRIVATE)
public static IRubyObject untrace_var(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) {
if (args.length == 0) throw context.getRuntime().newArgumentError(0, 1);
String var = args.length >= 1 ? args[0].toString() : null;
String var = args[0].toString();

// ignore if it's not a global var
if (var.charAt(0) != '$') return context.getRuntime().getNil();
Expand Down

0 comments on commit 7452ad4

Please sign in to comment.