Skip to content
Snippets Groups Projects
Commit 2c188fe3 authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Handle nullptr in to/fromIce

parent cf9e68ae
No related branches found
No related tags found
1 merge request!95Add introspection in RemoteGui
......@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment