1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-26 07:02:21 +01:00
This commit is contained in:
J. Nick Koston
2025-07-21 18:28:09 -10:00
parent c120676d19
commit d0511e118d

View File

@@ -56,10 +56,7 @@ class EntityBase {
void set_icon(const char *icon); void set_icon(const char *icon);
StringRef get_icon_ref() const { StringRef get_icon_ref() const {
#ifdef USE_ENTITY_ICON #ifdef USE_ENTITY_ICON
if (this->icon_c_str_ == nullptr) { return this->icon_c_str_ == nullptr ? StringRef("") : StringRef(this->icon_c_str_);
return StringRef("");
}
return StringRef(this->icon_c_str_);
#else #else
return StringRef(""); return StringRef("");
#endif #endif
@@ -117,10 +114,7 @@ class EntityBase_DeviceClass { // NOLINT(readability-identifier-naming)
void set_device_class(const char *device_class); void set_device_class(const char *device_class);
/// Get the device class as StringRef /// Get the device class as StringRef
StringRef get_device_class_ref() const { StringRef get_device_class_ref() const {
if (this->device_class_ == nullptr) { return this->device_class_ == nullptr ? StringRef("") : StringRef(this->device_class_);
return StringRef("");
}
return StringRef(this->device_class_);
} }
protected: protected:
@@ -135,10 +129,7 @@ class EntityBase_UnitOfMeasurement { // NOLINT(readability-identifier-naming)
void set_unit_of_measurement(const char *unit_of_measurement); void set_unit_of_measurement(const char *unit_of_measurement);
/// Get the unit of measurement as StringRef /// Get the unit of measurement as StringRef
StringRef get_unit_of_measurement_ref() const { StringRef get_unit_of_measurement_ref() const {
if (this->unit_of_measurement_ == nullptr) { return this->unit_of_measurement_ == nullptr ? StringRef("") : StringRef(this->unit_of_measurement_);
return StringRef("");
}
return StringRef(this->unit_of_measurement_);
} }
protected: protected: