diff --git a/internal/cat/icomserial.go b/internal/cat/icomserial.go index 379a3ee..9c6bbc6 100644 --- a/internal/cat/icomserial.go +++ b/internal/cat/icomserial.go @@ -2072,6 +2072,12 @@ func (b *IcomSerial) PlayTXAudio(pcm []byte, rate, ch, bits int, stop <-chan str // from (IcomDo); at worst a reconnect leaves this one connection stale, and // a stale transport fails fast on its closed done channel. port := b.port + // A nil port fails the assertions below too — and used to fail them with + // the sound-card message, sending an operator whose radio was simply OFF + // hunting through their audio devices. + if port == nil { + return fmt.Errorf("not connected to the radio — check the CAT link") + } type txPlayer interface { PlayTXAudio(pcm []byte, rate, ch, bits int, stop <-chan struct{}) error } @@ -2085,6 +2091,9 @@ func (b *IcomSerial) PlayTXAudio(pcm []byte, rate, ch, bits int, stop <-chan str // rig is reached over one. func (b *IcomSerial) TXAudioSender() (func([]byte) error, error) { port := b.port + if port == nil { + return nil, fmt.Errorf("not connected to the radio — check the CAT link") + } type sender interface { TXAudioSender() (func([]byte) error, error) }