If session doesn't exist, don't panic!
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user