File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -18,17 +18,15 @@ service::FieldResult<std::shared_ptr<service::Object>> Query::getHero(
18
18
service::FieldParams&&, std::optional<Episode>&& episodeArg) const
19
19
{
20
20
std::shared_ptr<service::Object> result;
21
+ const auto episode = episodeArg ? *episodeArg : Episode::NEW_HOPE;
21
22
22
- if (episodeArg )
23
+ if (const auto itr = heroes_. find (episode); itr != heroes_. end () )
23
24
{
24
- if (const auto itr = heroes_.find (*episodeArg); itr != heroes_.end ())
25
- {
26
- result = std::visit (
27
- [](const auto & hero) noexcept {
28
- return std::static_pointer_cast<service::Object>(hero);
29
- },
30
- itr->second );
31
- }
25
+ result = std::visit (
26
+ [](const auto & hero) noexcept {
27
+ return std::static_pointer_cast<service::Object>(hero);
28
+ },
29
+ itr->second );
32
30
}
33
31
34
32
return { result };
You can’t perform that action at this time.
0 commit comments