SamSaffron / flamegraph

Flamegraph profiling support for Ruby 2.0
MIT License
382 stars 36 forks source link

Added a nil guard #16

Closed adammeghji closed 8 years ago

adammeghji commented 8 years ago

Flamegraph::StackProfSampler throws a undefined method '[]' for nil:NilClass (NoMethodError) when result is nil. Added a simple guard.

In my particular use case, I'm trying to flamegraph a request which uses Doorkeeper middleware, which seems to raise and return 401 Unauthorized. This causes result to be nil, and thus explodes the sampler. Adding the guard allows the flamegraph to render as expected. Hopefully this is a safe change.

adammeghji commented 8 years ago

Thanks for the quick merge @tmm1 :)