From 282cda715580981fe2731e507ef6e2347d993a21 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Wed, 6 May 2020 10:48:28 +0200 Subject: [PATCH] Fix Radio segfault --- lib/src/radio/radio.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/src/radio/radio.cc b/lib/src/radio/radio.cc index 7430f3e1d..8356da955 100644 --- a/lib/src/radio/radio.cc +++ b/lib/src/radio/radio.cc @@ -683,7 +683,14 @@ bool radio::map_channels(channel_mapping& map, uint32_t physical_idx = map.get_carrier_idx(i); for (uint32_t j = 0; j < nof_antennas; j++) { if (physical_idx * nof_antennas + j < SRSLTE_MAX_CHANNELS) { - radio_buffers[physical_idx * nof_antennas + j] = buffer.get(i, j, nof_antennas) + sample_offset; + cf_t* ptr = buffer.get(i, j, nof_antennas); + + // Add sample offset only if it is a valid pointer + if (ptr != nullptr) { + ptr += sample_offset; + } + + radio_buffers[physical_idx * nof_antennas + j] = ptr; } else { return false; }