Skip to content

Commit

Permalink
add nil check rather checking error
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek9686 committed Oct 26, 2023
1 parent 93b56d9 commit 86a17cf
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions controllers/hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"net/http"
"strings"

"github.com/gorilla/mux"
"github.com/gravitl/netmaker/logger"
Expand Down Expand Up @@ -322,7 +321,7 @@ func deleteHostFromNetwork(w http.ResponseWriter, r *http.Request) {

node, err := logic.UpdateHostNetwork(currHost, network, false)
if err != nil {
if strings.Contains(err.Error(), "host not part of the network") && forceDelete {
if node == nil && forceDelete {
// force cleanup the node
node, err := logic.GetNodeByHostRef(hostid, network)
if err != nil {
Expand Down

0 comments on commit 86a17cf

Please sign in to comment.