@@ -1024,8 +1024,9 @@ std::shared_ptr<arangodb::LogicalCollection> TRI_vocbase_t::lookupCollection(
1024
1024
#else
1025
1025
auto dataSource = lookupDataSource (id);
1026
1026
1027
- return dataSource->category () == LogicalCollection::category ()
1028
- ? std::static_pointer_cast<LogicalCollection>(dataSource) : nullptr ;
1027
+ return dataSource && dataSource->category () == LogicalCollection::category ()
1028
+ ? std::static_pointer_cast<LogicalCollection>(dataSource)
1029
+ : nullptr ;
1029
1030
#endif
1030
1031
}
1031
1032
@@ -1040,8 +1041,9 @@ std::shared_ptr<arangodb::LogicalCollection> TRI_vocbase_t::lookupCollection(
1040
1041
#else
1041
1042
auto dataSource = lookupDataSource (nameOrId);
1042
1043
1043
- return dataSource->category () == LogicalCollection::category ()
1044
- ? std::static_pointer_cast<LogicalCollection>(dataSource) : nullptr ;
1044
+ return dataSource && dataSource->category () == LogicalCollection::category ()
1045
+ ? std::static_pointer_cast<LogicalCollection>(dataSource)
1046
+ : nullptr ;
1045
1047
#endif
1046
1048
}
1047
1049
@@ -1056,8 +1058,7 @@ std::shared_ptr<arangodb::LogicalCollection> TRI_vocbase_t::lookupCollectionByUu
1056
1058
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
1057
1059
return itr == _dataSourceByUuid.end ()
1058
1060
? nullptr
1059
- : std::dynamic_pointer_cast<arangodb::LogicalCollection>(itr->second )
1060
- ;
1061
+ : std::dynamic_pointer_cast<arangodb::LogicalCollection>(itr->second );
1061
1062
#else
1062
1063
return itr == _dataSourceByUuid.end ()
1063
1064
|| itr->second ->category () != LogicalCollection::category ()
@@ -1113,18 +1114,34 @@ std::shared_ptr<arangodb::LogicalDataSource> TRI_vocbase_t::lookupDataSource(
1113
1114
std::shared_ptr<arangodb::LogicalView> TRI_vocbase_t::lookupView (
1114
1115
TRI_voc_cid_t id
1115
1116
) const noexcept {
1116
- return std::dynamic_pointer_cast<arangodb::LogicalView>(
1117
- lookupDataSource (id)
1118
- );
1117
+ #ifdef ARANGODB_ENABLE_MAINTAINER_MODE
1118
+ return std::dynamic_pointer_cast<arangodb::LogicalView>(
1119
+ lookupDataSource (id)
1120
+ );
1121
+ #else
1122
+ auto dataSource = lookupDataSource (id);
1123
+
1124
+ return dataSource && dataSource->category () == LogicalView::category ()
1125
+ ? std::static_pointer_cast<LogicalView>(dataSource)
1126
+ : nullptr ;
1127
+ #endif
1119
1128
}
1120
1129
1121
1130
// / @brief looks up a view by name or stringified cid or uuid
1122
1131
std::shared_ptr<arangodb::LogicalView> TRI_vocbase_t::lookupView (
1123
1132
std::string const & nameOrId
1124
1133
) const noexcept {
1125
- return std::dynamic_pointer_cast<arangodb::LogicalView>(
1126
- lookupDataSource (nameOrId)
1127
- );
1134
+ #ifdef ARANGODB_ENABLE_MAINTAINER_MODE
1135
+ return std::dynamic_pointer_cast<arangodb::LogicalView>(
1136
+ lookupDataSource (nameOrId)
1137
+ );
1138
+ #else
1139
+ auto dataSource = lookupDataSource (nameOrId);
1140
+
1141
+ return dataSource && dataSource->category () == LogicalView::category ()
1142
+ ? std::static_pointer_cast<LogicalView>(dataSource)
1143
+ : nullptr ;
1144
+ #endif
1128
1145
}
1129
1146
1130
1147
// / @brief creates a new collection from parameter set
0 commit comments