Skip to content

Commit

Permalink
fix: resolve static analysis defects
Browse files Browse the repository at this point in the history
Signed-off-by: Daeyeon Jeong <[email protected]>
  • Loading branch information
daeyeon authored and hs0225 committed Jul 19, 2023
1 parent 4b16e70 commit 51eeb14
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions deps/node/src/module_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,9 @@ static MaybeLocal<Promise> ImportModuleDynamically(
->Uint32Value(context)
.ToChecked();
if (type == ScriptType::kScript) {
contextify::ContextifyScript* wrap = env->id_to_script_map.find(id)->second;
object = wrap->object();
auto it = env->id_to_function_map.find(id);
CHECK_NE(it, env->id_to_function_map.end());
object = it->second->object();
} else if (type == ScriptType::kModule) {
ModuleWrap* wrap = ModuleWrap::GetFromID(env, id);
object = wrap->object();
Expand Down
2 changes: 1 addition & 1 deletion deps/node/src/node_messaging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ class SerializerDelegate : public ValueSerializer::Delegate {
std::vector<BaseObjectPtr<BaseObject>> nested_transferables;
if (!host_objects_[i]->NestedTransferables().To(&nested_transferables))
return Nothing<bool>();
for (auto nested_transferable : nested_transferables) {
for (auto& nested_transferable : nested_transferables) {
if (std::find(host_objects_.begin(),
host_objects_.end(),
nested_transferable) == host_objects_.end()) {
Expand Down
4 changes: 2 additions & 2 deletions src/api-environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -777,8 +777,8 @@ MaybeLocal<v8::Object> v8::RegExp::Exec(Local<Context> context,
}

auto vector = ValueVectorRef::create();
for (auto tokens : result.m_matchResults) {
for (auto token : tokens) {
for (auto& tokens : result.m_matchResults) {
for (auto& token : tokens) {
auto match = subject->substring(token.m_start, token.m_end);
vector->pushBack(match);
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/utils/logger/flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void Flags::add(const std::string& userOption) {
std::string optionValues = userOption.substr(userOption.find_first_of('=') +
1); // +1 for skipping '='
auto tokens = strSplit(optionValues, ',');
for (auto token : tokens) {
for (auto& token : tokens) {
flag->addValue(token);
}
}
Expand Down

0 comments on commit 51eeb14

Please sign in to comment.