Skip to content

Commit

Permalink
fix tracer name empty exception (#6915)
Browse files Browse the repository at this point in the history
Co-authored-by: Lukasz Rozmej <[email protected]>
  • Loading branch information
2 people authored and kamilchodola committed Jun 14, 2024
1 parent 0068729 commit 7462391
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,20 @@ public void IsNativeTracer_TracerNameDoesNotExist()

Assert.False(isNativeTracer);
}

[Test]
public void CreateTracer_TracerNameIsEmpty()
{
var isNativeTracer = GethLikeNativeTracerFactory.IsNativeTracer(string.Empty);

Assert.False(isNativeTracer);
}

[Test]
public void CreateTracer_TracerNameIsNull()
{
var isNativeTracer = GethLikeNativeTracerFactory.IsNativeTracer(null);

Assert.False(isNativeTracer);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static GethLikeNativeTxTracer CreateTracer(GethTraceOptions options) =>

public static bool IsNativeTracer(string tracerName)
{
return _tracers.ContainsKey(tracerName);
return !string.IsNullOrWhiteSpace(tracerName) && _tracers.ContainsKey(tracerName);
}

private static void RegisterNativeTracers()
Expand Down

0 comments on commit 7462391

Please sign in to comment.