@@ -403,15 +403,23 @@ void DebugRouterCore::OnFailure(
403403 connection_state_.load (std::memory_order_relaxed) == DISCONNECTED) {
404404 return ;
405405 }
406- if (current_transceiver_->GetType () == ConnectionType::kUsb ) {
407- Json::Value catagaryJson;
408- catagaryJson[" connect_type" ] = " usb" ;
409- catagaryJson[" error_msg" ] = error_message;
410- std::string catagary = catagaryJson.toStyledString ();
411- Report (" OnFailure" , catagary, " " , " " );
406+ if (current_transceiver_ != nullptr ) {
407+ if (current_transceiver_->GetType () == ConnectionType::kUsb ) {
408+ Json::Value catagaryJson;
409+ catagaryJson[" connect_type" ] = " usb" ;
410+ catagaryJson[" error_msg" ] = error_message;
411+ std::string catagary = catagaryJson.toStyledString ();
412+ Report (" OnFailure" , catagary, " " , " " );
413+ } else {
414+ Json::Value catagaryJson;
415+ catagaryJson[" connect_type" ] = " websocket" ;
416+ catagaryJson[" error_msg" ] = error_message;
417+ std::string catagary = catagaryJson.toStyledString ();
418+ Report (" OnFailure" , catagary, " " , " " );
419+ }
412420 } else {
413421 Json::Value catagaryJson;
414- catagaryJson[" connect_type" ] = " websocket " ;
422+ catagaryJson[" connect_type" ] = " none " ;
415423 catagaryJson[" error_msg" ] = error_message;
416424 std::string catagary = catagaryJson.toStyledString ();
417425 Report (" OnFailure" , catagary, " " , " " );
0 commit comments