8000
File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -70,19 +70,21 @@ std::shared_ptr<LogicalCollection> CollectionNameResolver::getCollection(std::st
70
70
// ////////////////////////////////////////////////////////////////////////////
71
71
72
72
TRI_voc_cid_t CollectionNameResolver::getCollectionIdLocal (std::string const & name) const {
73
- if (name[0 ] >= ' 0' && name[0 ] <= ' 9' ) {
73
+ if (name.empty ()) {
74
+ return 0 ;
75
+ }
76
+
77
+ if (isdigit (name[0 ])) {
74
78
// name is a numeric id
75
79
return NumberUtils::atoi_zero<TRI_voc_cid_t>(name.data (), name.data () + name.size ());
76
80
}
77
81
78
82
auto collection = getCollectionStruct (name);
79
-
80
83
if (collection != nullptr ) {
81
84
return collection->id ();
82
85
}
83
86
84
87
auto view = _vocbase.lookupView (name);
85
-
86
88
if (view) {
87
89
return view->id ();
88
90
}
@@ -101,7 +103,10 @@ TRI_voc_cid_t CollectionNameResolver::getCollectionIdCluster(std::string const&
101
103
if (!ServerState::isRunningInCluster (_serverRole)) {
1
9B23
02
104
return getCollectionIdLocal (name);
103
105
}
104
- if (name[0 ] >= ' 0' && name[0 ] <= ' 9' ) {
106
+ if (name.empty ()) {
107
+ return 0 ;
108
+ }
109
+ if (isdigit (name[0 ])) {
105
110
// name is a numeric id
106
111
TRI_voc_cid_t cid =
107
112
NumberUtils::atoi_zero<TRI_voc_cid_t>(name.data (), name.data () + name.size ());
@@ -135,6 +140,7 @@ TRI_voc_cid_t CollectionNameResolver::getCollectionIdCluster(std::string const&
135
140
return vinfo->id ();
136
141
}
137
142
} catch (...) {
143
+ // TODO: ?
138
144
}
139
145
140
146
return 0 ;
You can’t perform that action at this time.
0 commit comments