Skip to content

Commit

Permalink
nullptr -> folly::none in fbobjc/xplat
Browse files Browse the repository at this point in the history
Summary:
In preparation for D12843022, starting using folly::none instead of
nullptr to indicate an empty optional.

Reviewed By: nlutsenko

Differential Revision: D13052075

fbshipit-source-id: ed869f98b5fb1556bca1e01e3ac3e44ea914dc52
  • Loading branch information
chadaustin authored and KusStar committed Oct 27, 2020
1 parent cad86ab commit 69ab6fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions ReactCommon/cxxreact/ModuleRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ folly::Optional<ModuleConfig> ModuleRegistry::getConfig(const std::string& name)

if (it == modulesByName_.end()) {
if (unknownModules_.find(name) != unknownModules_.end()) {
return nullptr;
return folly::none;
}
if (!moduleNotFoundCallback_ ||
!moduleNotFoundCallback_(name) ||
(it = modulesByName_.find(name)) == modulesByName_.end()) {
unknownModules_.insert(name);
return nullptr;
return folly::none;
}
}
size_t index = it->second;
Expand Down Expand Up @@ -141,7 +141,7 @@ folly::Optional<ModuleConfig> ModuleRegistry::getConfig(const std::string& name)

if (config.size() == 2 && config[1].empty()) {
// no constants or methods
return nullptr;
return folly::none;
} else {
return ModuleConfig{index, config};
}
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/jsiexecutor/jsireact/JSINativeModules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ folly::Optional<Object> JSINativeModules::createModule(

auto result = m_moduleRegistry->getConfig(name);
if (!result.hasValue()) {
return nullptr;
return folly::none;
}

Value moduleInfo = m_genNativeModuleJS->call(
Expand Down

0 comments on commit 69ab6fa

Please sign in to comment.