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"]
|
instanceName := vars["instanceName"]
|
||||||
|
|
||||||
s := core.SessionGet(sessionId)
|
s := core.SessionGet(sessionId)
|
||||||
i := core.InstanceGet(s, instanceName)
|
if s != nil {
|
||||||
err := core.InstanceDelete(s, i)
|
i := core.InstanceGet(s, instanceName)
|
||||||
if err != nil {
|
err := core.InstanceDelete(s, i)
|
||||||
rw.WriteHeader(http.StatusInternalServerError)
|
if err != nil {
|
||||||
|
rw.WriteHeader(http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rw.WriteHeader(http.StatusNotFound)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user