fix nil pointer error
This commit is contained in:
@@ -153,8 +153,11 @@ func (aH *AccessHandler) DeleteWorkspace(c *gin.Context) {
|
||||
c.JSON(http.StatusInternalServerError, nil)
|
||||
return
|
||||
}
|
||||
|
||||
for _, u := range users {
|
||||
if u.Settings.Workspace.Name == workspace.Name {
|
||||
if u.Workspaces == nil {
|
||||
continue
|
||||
} else if u.Settings.Workspace.Name == workspace.Name {
|
||||
u.Settings.Workspace = nil
|
||||
}
|
||||
|
||||
@@ -163,13 +166,14 @@ func (aH *AccessHandler) DeleteWorkspace(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
// crearemove folder
|
||||
// remove folder
|
||||
err = os.RemoveAll(workspace.Uuid.String())
|
||||
if err != nil {
|
||||
aH.logger.Error("DeleteWorkspace", err)
|
||||
c.JSON(http.StatusBadRequest, models.NewJsonErrorResponse(err))
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
|
||||
Reference in New Issue
Block a user