gin icon indicating copy to clipboard operation
gin copied to clipboard

fix(context): add check to avoid nil pointer

Open jbleduigou opened this issue 1 year ago • 3 comments

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.

jbleduigou avatar Jun 08 '22 12:06 jbleduigou

Please also check the same code base.

c.engine.ContextWithFallback

appleboy avatar Jun 08 '22 14:06 appleboy

cc wei840222

appleboy avatar Jun 08 '22 14:06 appleboy

@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

wei840222 avatar Aug 04 '22 02:08 wei840222