@@ -7,7 +7,7 @@ use cpal::{
77 Device , Host ,
88 traits:: { DeviceTrait , HostTrait } ,
99} ;
10- use local_ip_address:: { list_afinet_netifas, local_ip } ;
10+ use local_ip_address:: list_afinet_netifas;
1111use notify_rust:: Notification ;
1212use rtrb:: RingBuffer ;
1313use tokio:: sync:: mpsc:: Sender ;
@@ -202,11 +202,22 @@ impl AppState {
202202
203203 let connect_options = match config. connection_mode {
204204 ConnectionMode :: Tcp => {
205- let ip = config. ip . unwrap_or ( local_ip ( ) . unwrap ( ) ) ;
205+ let Some ( ip) = config. ip_or_default ( ) else {
206+ let e = "no address ip found" ;
207+
208+ error ! ( "failed to start audio stream: {e}" ) ;
209+ return self . add_log ( & e. to_string ( ) ) ;
210+ } ;
211+
206212 ConnectOption :: Tcp { ip }
207213 }
208214 ConnectionMode :: Udp => {
209- let ip = config. ip . unwrap_or ( local_ip ( ) . unwrap ( ) ) ;
215+ let Some ( ip) = config. ip_or_default ( ) else {
216+ let e = "no address ip found" ;
217+
218+ error ! ( "failed to start audio stream: {e}" ) ;
219+ return self . add_log ( & e. to_string ( ) ) ;
220+ } ;
210221 ConnectOption :: Udp { ip }
211222 }
212223 #[ cfg( feature = "adb" ) ]
@@ -308,7 +319,7 @@ impl Application for AppState {
308319 ip : * ip,
309320 } )
310321 . collect :: < Vec < _ > > ( ) ;
311- let network_adapter = match & flags. config . data ( ) . ip {
322+ let network_adapter = match & flags. config . data ( ) . ip_or_default ( ) {
312323 Some ( ip) => match network_adapters. iter ( ) . find ( |adapter| adapter. ip == * ip) {
313324 Some ( adapter) => Some ( adapter. clone ( ) ) ,
314325 None => {
0 commit comments