Updated GetSendFilters to support export of polymorphic objects

DocumentStoreCore didn't check for null handle when retrieving stored data
This commit is contained in:
Ralph Wessel
2024-09-20 11:34:46 +01:00
parent bd200492fd
commit 6d3126e1e1
3 changed files with 6 additions and 5 deletions
@@ -34,8 +34,8 @@ GetSendFilters::GetSendFilters() : BridgeMethod{"GetSendFilters", [&]() {
return: The send filters
--------------------------------------------------------------------*/
std::unique_ptr<Cargo> GetSendFilters::run() const {
Vector<SendFilter> filters;
auto filters = std::make_unique<Vector<SendFilter>>();
//filters.emplace_back(ArchicadEverythingFilter{}); //TODO: Implement as required
filters.emplace_back(ArchicadSelectionFilter{});
return std::make_unique<WrappedValue>(filters);
filters->emplace_back(ArchicadSelectionFilter{});
return std::make_unique<WrappedValue>(std::move(filters));
} //GetSendFilters::run
@@ -94,7 +94,8 @@ namespace {
void copyHandleToMemory(const GSHandle& handle, active::utility::Memory& memory) {
auto storeSize = BMGetHandleSize(handle);
memory.resize(storeSize);
active::utility::Memory::copy(memory.data(), *handle, storeSize, storeSize);
if ((storeSize > 0) && (*handle != nullptr))
active::utility::Memory::copy(memory.data(), *handle, storeSize, storeSize);
} //copyHandleToMemory
#endif
@@ -162,7 +162,7 @@ namespace speckle::database {
return m_cache.get(); //Return an empty container if there's no data
//Import the document data into the record cache
if constexpr (std::is_same_v<ObjWrapper, Obj>)
Transport().receive(std::forward<active::serialise::Cargo&&>(*m_cache), active::serialise::Identity{}, storedData);
Transport().receive(std:: forward<active::serialise::Cargo&&>(*m_cache), active::serialise::Identity{}, storedData);
else
Transport().receive(ObjWrapper{*m_cache}, active::serialise::Identity{}, storedData);
return m_cache.get();