Skip to content

Commit

Permalink
fix: do not close serial port if nil (fixes #805)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilsocket committed Jan 8, 2021
1 parent ffe20c5 commit 2610d4b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/gps/gps.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@ func (mod *GPS) Start() error {
}

return mod.SetRunning(true, func() {
defer mod.serial.Close()

mod.Info("started on port %s ...", mod.serialPort)

if mod.serial != nil {
defer mod.serial.Close()

for mod.Running() {
mod.readFromSerial()
}
Expand Down

0 comments on commit 2610d4b

Please sign in to comment.