diff --git a/test/test_nr1.cc b/test/test_nr1.cc index 828fdab..7d97089 100644 --- a/test/test_nr1.cc +++ b/test/test_nr1.cc @@ -204,6 +204,11 @@ namespace pEp { _is_bound = true; pEpLogClass(to_string()); set_owner(is_owner); + + //if the c_str_p is nullptr then init with "" + if (*_c_str_pp == nullptr) { + this->operator=(""); + } } ~String() @@ -225,14 +230,7 @@ namespace pEp { _free(); // ALLOCATION - if (str.empty()) { - // if the new value is empty str, lets point to nothing - *_c_str_pp = nullptr; - _c_str_p = *_c_str_pp; - } else { - *_c_str_pp = pEp::alloc_str(str); - _c_str_p = *_c_str_pp; - } + *_c_str_pp = _copy(str); pEpLogClass("After: " + to_string()); return *this; }