From 1935c8d50b6b9d3fa8a5fcdb860cd3241a35e8df Mon Sep 17 00:00:00 2001 From: Troels Thomsen Date: Thu, 27 Apr 2017 14:57:47 +0200 Subject: [PATCH] Return early to prevent nil pointer dereference Signed-off-by: Troels Thomsen --- registry/handlers/app.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/registry/handlers/app.go b/registry/handlers/app.go index 5393e88d..5b4c9f37 100644 --- a/registry/handlers/app.go +++ b/registry/handlers/app.go @@ -859,8 +859,11 @@ func (app *App) eventBridge(ctx *Context, r *http.Request) notifications.Listene // nameRequired returns true if the route requires a name. func (app *App) nameRequired(r *http.Request) bool { route := mux.CurrentRoute(r) + if route == nil { + return true + } 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