Skip to content

Commit

Permalink
Adding nil check to listener deletion to prevent panic
Browse files Browse the repository at this point in the history
  • Loading branch information
RafBishopFox committed May 14, 2024
1 parent df65d7f commit 4082378
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server/db/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"crypto/sha256"
"encoding/hex"
"errors"
"fmt"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -599,6 +600,9 @@ func DeleteListener(JobID uint32) error {
if result.Error != nil {
return result.Error
}
if listener == nil {
return fmt.Errorf("Job ID %d not found in database", JobID)
}
listenerID := listener.ID
switch listener.Type {
case constants.HttpStr, constants.HttpsStr:
Expand Down

0 comments on commit 4082378

Please sign in to comment.