1
0
Fork 0

Bug fix/handle nullptr (#7432)

* handle more potential nullptrs, fix try/catch scope

* fix none reply
This commit is contained in:
Wilfried Goesgens 2018-11-23 12:52:30 +01:00 committed by Jan
parent ed4af5acf8
commit ce5273c852
1 changed files with 12 additions and 8 deletions

View File

@ -118,7 +118,11 @@ TRI_voc_cid_t CollectionNameResolver::getCollectionIdCluster(
// We have to look up the collection info:
auto* ci = ClusterInfo::instance();
auto const cinfo = (ci) ? ci->getCollectionNT(_vocbase.name(), name) : nullptr;
if (ci == nullptr) {
return 0;
}
auto const cinfo = ci->getCollectionNT(_vocbase.name(), name);
if (cinfo != nullptr) {
return cinfo->id();
@ -350,19 +354,19 @@ std::shared_ptr<LogicalDataSource> CollectionNameResolver::getDataSource(
// cluster coordinator
auto* ci = ClusterInfo::instance();
if (!ci) {
if (ci == nullptr) {
return nullptr;
}
try {
ptr = (ci) ? ci->getCollectionNT(_vocbase.name(), nameOrId) : nullptr;
ptr = ci->getCollectionNT(_vocbase.name(), nameOrId);
if (ptr == nullptr) {
if (ptr == nullptr) {
try {
ptr = ci->getView(_vocbase.name(), nameOrId);
} catch (...) {
LOG_TOPIC(ERR, arangodb::Logger::FIXME)
<< "caught exception while resolving cluster data-source: " << nameOrId;
}
} catch (...) {
LOG_TOPIC(ERR, arangodb::Logger::FIXME)
<< "caught exception while resolving cluster data-source: " << nameOrId;
}
}