diff --git a/ReactCommon/fabric/core/propsConversions.h b/ReactCommon/fabric/core/propsConversions.h index 6ed2d795adb..1835a3dfb4f 100644 --- a/ReactCommon/fabric/core/propsConversions.h +++ b/ReactCommon/fabric/core/propsConversions.h @@ -8,6 +8,7 @@ #pragma once #include +#include #include #include #include @@ -53,15 +54,15 @@ T convertRawProp( U const &defaultValue = U(), char const *namePrefix = nullptr, char const *nameSuffix = nullptr) { - const auto rawValue = rawProps.at(name, namePrefix, nameSuffix); + const auto *rawValue = rawProps.at(name, namePrefix, nameSuffix); - if (!rawValue) { + if (LIKELY(rawValue == nullptr)) { return sourceValue; } // Special case: `null` always means "the prop was removed, use default // value". - if (!rawValue->hasValue()) { + if (UNLIKELY(!rawValue->hasValue())) { return defaultValue; } @@ -78,15 +79,15 @@ static better::optional convertRawProp( better::optional const &defaultValue = {}, char const *namePrefix = nullptr, char const *nameSuffix = nullptr) { - const auto rawValue = rawProps.at(name, namePrefix, nameSuffix); + const auto *rawValue = rawProps.at(name, namePrefix, nameSuffix); - if (!rawValue) { + if (LIKELY(rawValue == nullptr)) { return sourceValue; } // Special case: `null` always means `the prop was removed, use default // value`. - if (!rawValue->hasValue()) { + if (UNLIKELY(!rawValue->hasValue())) { return defaultValue; }