Skip to content

Commit

Permalink
Check for null when dereferencing address
Browse files Browse the repository at this point in the history
  • Loading branch information
krksgbr committed Apr 3, 2024
1 parent 62f5d45 commit ba9ad8e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dividat-driver/firmware/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ type OnProgress func(msg string)
func Update(parentCtx context.Context, image io.Reader, deviceSerial *string, configuredAddr *string, onProgress OnProgress) (fail error) {
// 1: Find address of a Senso in normal mode
var controllerHost string
if *configuredAddr != "" {
if configuredAddr != nil && *configuredAddr != "" {
// Use specified controller address
controllerHost = *configuredAddr
onProgress(fmt.Sprintf("Using specified controller address '%s'.", controllerHost))
Expand Down Expand Up @@ -94,7 +94,7 @@ func Update(parentCtx context.Context, image io.Reader, deviceSerial *string, co

// 3: Find address of Senso in bootloader mode
var dfuHost string
if *configuredAddr != "" {
if configuredAddr != nil && *configuredAddr != "" {
dfuHost = *configuredAddr
} else {
ctx, cancel := context.WithTimeout(parentCtx, 60*time.Second)
Expand Down

0 comments on commit ba9ad8e

Please sign in to comment.