Fix nil pointer dereference when updating Template

When updating a template with empty "Extra CLI Arguments" field, the
template.Arguments pointer becomes nil. The previous check whether this
variable is the empty string fails if it is already nil.
The fix introduces a lazy nil check before the empty string-check.
This commit is contained in:
Viktor Anderling 2017-05-16 16:49:56 +02:00
parent 39298cb0d2
commit bb064198dd

View File

@ -131,7 +131,7 @@ func UpdateTemplate(w http.ResponseWriter, r *http.Request) {
return
}
if *template.Arguments == "" {
if template.Arguments != nil && *template.Arguments == "" {
template.Arguments = nil
}