gin
gin copied to clipboard
fix(context): add check to avoid nil pointer
What?
Proposed fix for https://github.com/gin-gonic/gin/issues/3178
Why?
In cases where we create a context with no engine (e.g. unit tests), it might lead to a nil pointer dereference.
How?
Added a new check to verify that the engine is not null.
Please also check the same code base.
c.engine.ContextWithFallback
cc wei840222
@jbleduigou
I create the pr for the other c.engine.ContextWithFallback
part in your repo ?
https://github.com/jbleduigou/gin/tree/fix-nil-pointer-dereference