Return nil when application cannot retrieved

This commit is contained in:
eikendev 2020-11-28 09:10:51 +01:00
parent 0017f9821a
commit 8966a96c39
No known key found for this signature in database
GPG key ID: A1BDB1B28C8EF694

View file

@ -14,6 +14,7 @@ func GetApplication(ctx *gin.Context) *model.Application {
app, ok := ctx.MustGet("app").(*model.Application)
if app == nil || !ok {
ctx.AbortWithError(http.StatusInternalServerError, errors.New("an error occured while retrieving application from context"))
return nil
}
return app