diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index f821e6316..8806b4e1c 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -2159,6 +2159,9 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr) std::cerr << "locked_genReqGrpTransaction(): " << std::endl; #endif + std::map grpMetaMap; + std::map::const_iterator metaIter; + std::list grpItemL; std::list::iterator lit = tr->mItems.begin(); @@ -2168,6 +2171,7 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr) if(item) { grpItemL.push_back(item); + grpMetaMap[item->grpId] = NULL; }else { #ifdef NXS_NET_DEBUG @@ -2177,8 +2181,11 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr) } } - std::map grpMetaMap; - std::map::const_iterator metaIter; + if (grpItemL.empty()) + { + return; + } + mDataStore->retrieveGxsGrpMetaData(grpMetaMap); // now do compare and add loop @@ -2198,7 +2205,7 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr) metaIter = grpMetaMap.find(grpId); bool haveItem = false; bool latestVersion = false; - if (metaIter != grpMetaMap.end()) + if (metaIter != grpMetaMap.end() && metaIter->second) { haveItem = true; latestVersion = grpSyncItem->publishTs > metaIter->second->mPublishTs;