diff --git a/lib/src/radio/radio.cc b/lib/src/radio/radio.cc index e83049f18..d12c06844 100644 --- a/lib/src/radio/radio.cc +++ b/lib/src/radio/radio.cc @@ -32,9 +32,14 @@ namespace srslte { bool radio::init(log_filter* _log_h, const char* args, char* devname, uint32_t nof_channels) { - std::vector tmp_args(strlen(args) + 1); - strcpy(&tmp_args[0], args); - if (srslte_rf_open_devname(&rf_device, devname, &tmp_args[0], nof_channels)) { + char* mutable_arg_str = nullptr; + std::vector args_vec; + if (args != nullptr) { + args_vec.resize(strlen(args) + 1); + strcpy(&args_vec[0], args); + mutable_arg_str = &args_vec[0]; + } + if (srslte_rf_open_devname(&rf_device, devname, mutable_arg_str, nof_channels)) { ERROR("Error opening RF device\n"); return false; }