diff --git a/lib/include/srslte/radio/radio_multi.h b/lib/include/srslte/radio/radio_multi.h index d99490978..02c9fd31d 100644 --- a/lib/include/srslte/radio/radio_multi.h +++ b/lib/include/srslte/radio/radio_multi.h @@ -126,7 +126,16 @@ public: { radios.at(radio_idx)->set_rx_srate(srate); } - srslte_rf_info_t* get_info(const uint32_t& radio_idx) override { return radios.at(radio_idx)->get_info(); } + srslte_rf_info_t* get_info(const uint32_t& radio_idx) override + { + srslte_rf_info_t* ret = nullptr; + + if (radio_idx < radios.size()) { + ret = radios.at(radio_idx)->get_info(); + } + + return ret; + } protected: rf_args_t args = {}; diff --git a/srsue/src/phy/sync.cc b/srsue/src/phy/sync.cc index a5f9f1287..a9f45a56a 100644 --- a/srsue/src/phy/sync.cc +++ b/srsue/src/phy/sync.cc @@ -718,11 +718,15 @@ void sync::set_agc_enable(bool enable) if (enable) { if (running && radio_h) { srslte_rf_info_t* rf_info = radio_h->get_info(0); - srslte_ue_sync_start_agc( - &ue_sync, callback_set_rx_gain, rf_info->min_rx_gain, rf_info->max_rx_gain, radio_h->get_rx_gain(0)); - search_p.set_agc_enable(true); + if (rf_info) { + srslte_ue_sync_start_agc( + &ue_sync, callback_set_rx_gain, rf_info->min_rx_gain, rf_info->max_rx_gain, radio_h->get_rx_gain(0)); + search_p.set_agc_enable(true); + } else { + ERROR("Error: Radio does not provide RF information\n"); + } } else { - ERROR("Error setting AGC: PHY not initiatec\n"); + ERROR("Error setting AGC: PHY not initiated\n"); } } else { ERROR("Error stopping AGC: not implemented\n");