netconf-c++: handle empty <data/> for <get/> RPC

The <get-config/> RPC already handled this, so make it similar.

Change-Id: Iba5bc44f18939a30a273614110a79bd4d69a39df
diff --git a/src/netconf-client.cpp b/src/netconf-client.cpp
index 096b929..794f5b1 100644
--- a/src/netconf-client.cpp
+++ b/src/netconf-client.cpp
@@ -283,10 +283,11 @@
         throw std::runtime_error("Cannot create get RPC");
     }
     auto reply = impl::do_rpc_data(this, std::move(rpc));
+    auto dataNode = libyang::create_new_Data_Node(reply->data);
     // TODO: can we do without copying?
     // If we just default-construct a new node (or use the create_new_Data_Node) and then set reply->data to nullptr,
     // there are mem leaks and even libnetconf2 complains loudly.
-    return libyang::create_new_Data_Node(reply->data)->dup_withsiblings(1);
+    return dataNode ? dataNode->dup_withsiblings(1) : nullptr;
 }
 
 std::string Session::getSchema(const std::string_view identifier, const std::optional<std::string_view> version)