Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 26fa682

Browse files
committedSep 20, 2022
Reject duplicate input names in C Predict API
1 parent e2ed553 commit 26fa682

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎src/c_api/c_predict_api.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,9 @@ int _CreatePartialOut(const char* symbol_json_str,
201201
std::unordered_map<std::string, size_t> key2arg;
202202
for (size_t i = 0; i < arg_names.size(); ++i) {
203203
std::string key = arg_names[i];
204-
key2arg[key] = i;
204+
auto emplace_res = ret->key2arg.emplace(key, i);
205+
CHECK(emplace_res.second)
206+
<< "Input parameter name appears more than once";
205207
}
206208

207209
try {

0 commit comments

Comments
 (0)
This repository has been archived.