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.
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.