Add nil check to prevent crash if tracing never started