diff --git a/source/RobotAPI/libraries/armem/core/ice_conversions.h b/source/RobotAPI/libraries/armem/core/ice_conversions.h index 9b7550f683c1f1ead59f6ee40717eb744545e6d3..7aa699a5dfb960a7534713f8804043acdc10d1da 100644 --- a/source/RobotAPI/libraries/armem/core/ice_conversions.h +++ b/source/RobotAPI/libraries/armem/core/ice_conversions.h @@ -71,7 +71,10 @@ namespace armarx::armem template <class IceT, class CppT> void toIce(IceT& ice, const std::unique_ptr<CppT>& cppPointer) { - toIce(ice, *cppPointer); + if (cppPointer) + { + toIce(ice, *cppPointer); + } } template <class IceT, class CppT> void fromIce(const IceT& ice, std::unique_ptr<CppT>& cppPointer) @@ -89,20 +92,37 @@ namespace armarx::armem template <class IceT, class CppT> void fromIce(const ::IceInternal::Handle<IceT>& ice, CppT& cpp) { - fromIce(*ice, cpp); + if (ice) + { + fromIce(*ice, cpp); + } } template <class IceT, class CppT> void toIce(::IceInternal::Handle<IceT>& ice, const std::unique_ptr<CppT>& cppPointer) { - ice = new IceT(); - toIce(*ice, *cppPointer); + if (cppPointer) + { + ice = new IceT(); + toIce(*ice, *cppPointer); + } + else + { + ice = nullptr; + } } template <class IceT, class CppT> void fromIce(const ::IceInternal::Handle<IceT>& ice, std::unique_ptr<CppT>& cppPointer) { - cppPointer = std::make_unique<CppT>(); - fromIce(*ice, *cppPointer); + if (ice) + { + cppPointer = std::make_unique<CppT>(); + fromIce(*ice, *cppPointer); + } + else + { + cppPointer = nullptr; + } } template <class IceT, class CppT>