If session doesn't exist, don't panic!

This commit is contained in:
Jonathan Leibiusky @xetorthio
2017-08-30 18:55:13 -03:00
parent e079517803
commit 4b00a9c0eb

View File

@@ -12,10 +12,15 @@ func DeleteInstance(rw http.ResponseWriter, req *http.Request) {
instanceName := vars["instanceName"]
s := core.SessionGet(sessionId)
if s != nil {
i := core.InstanceGet(s, instanceName)
err := core.InstanceDelete(s, i)
if err != nil {
rw.WriteHeader(http.StatusInternalServerError)
return
}
} else {
rw.WriteHeader(http.StatusNotFound)
return
}
}