diff --git a/lib/include/srsran/asn1/asn1_utils.h b/lib/include/srsran/asn1/asn1_utils.h index 87696d7b6..f1dcfcd74 100644 --- a/lib/include/srsran/asn1/asn1_utils.h +++ b/lib/include/srsran/asn1/asn1_utils.h @@ -193,8 +193,12 @@ public: { size_ = nof_items; cap_ = nof_items; - data_ = new T[cap_]; - std::copy(ptr, ptr + size_, data_); + if (ptr != NULL) { + data_ = new T[cap_]; + std::copy(ptr, ptr + size_, data_); + } else { + data_ = NULL; + } } ~dyn_array() {