diff --git a/src/types.cc b/src/types.cc index c1d1c6f..c52f1ff 100644 --- a/src/types.cc +++ b/src/types.cc @@ -96,7 +96,7 @@ namespace pEp template<> bool StringPairList::empty() const { - return value && value->value; + return !(value && value->value); } template<> @@ -118,14 +118,19 @@ namespace pEp template<> void StringPairList::push_back(::stringpair_t*&& sp) { - stringpair_list_add(value, sp); + auto last = stringpair_list_add(value, sp); + if(value==nullptr) + value = last; + sp = nullptr; } template<> void StringPairList::push_back(StringPair&& sp) { - stringpair_list_add(value, sp.move_out()); + auto last = stringpair_list_add(value, sp.move_out()); + if(value==nullptr) + value = last; } template<>