forked from TrueCloudLab/distribution
Return early to prevent nil pointer dereference
Signed-off-by: Troels Thomsen <troels@thomsen.io>
This commit is contained in:
parent
f4a1d3e0d5
commit
1935c8d50b
1 changed files with 4 additions and 1 deletions
|
@ -859,8 +859,11 @@ func (app *App) eventBridge(ctx *Context, r *http.Request) notifications.Listene
|
||||||
// nameRequired returns true if the route requires a name.
|
// nameRequired returns true if the route requires a name.
|
||||||
func (app *App) nameRequired(r *http.Request) bool {
|
func (app *App) nameRequired(r *http.Request) bool {
|
||||||
route := mux.CurrentRoute(r)
|
route := mux.CurrentRoute(r)
|
||||||
|
if route == nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
routeName := route.GetName()
|
routeName := route.GetName()
|
||||||
return route == nil || (routeName != v2.RouteNameBase && routeName != v2.RouteNameCatalog)
|
return routeName != v2.RouteNameBase && routeName != v2.RouteNameCatalog
|
||||||
}
|
}
|
||||||
|
|
||||||
// apiBase implements a simple yes-man for doing overall checks against the
|
// apiBase implements a simple yes-man for doing overall checks against the
|
||||||
|
|
Loading…
Reference in a new issue