fix nil pointer error

This commit is contained in:
Adrian Zürcher
2026-02-17 16:44:29 +01:00
parent c4bd121388
commit 9dc6c217fa

View File

@@ -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{