1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-27 14:57:05 +00:00

minor: fix Context.ViewData ignored when nil is passed as view data on Context.View method

This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-08-30 16:14:32 +03:00
parent 600eb645df
commit 6ee69ffd1c
2 changed files with 17 additions and 1 deletions

View File

@@ -2792,7 +2792,7 @@ func (ctx *Context) View(filename string, optionalViewModel ...interface{}) erro
layout := ctx.values.GetString(cfg.GetViewLayoutContextKey())
var bindingData interface{}
if len(optionalViewModel) > 0 {
if len(optionalViewModel) > 0 && optionalViewModel[0] != nil {
// a nil can override the existing data or model sent by `ViewData`.
bindingData = optionalViewModel[0]
} else {