[display] Fix the null pointer comparison warning in the display log macro (#19984)

This commit is contained in:
J. Nick Koston
2026-10-01 13:34:17 -05:00
committed by GitHub
parent 3bae9e4ee2
commit e9f0a53ec9
+4 -2
View File
@@ -287,13 +287,15 @@ template<typename T> class DisplayWriter {
// Type alias for Display writer - uses optimized DisplayWriter instead of std::function
using display_writer_t = DisplayWriter<Display>;
// Callers usually pass `this`; checking a copy keeps GCC's -Wnonnull-compare quiet.
#define LOG_DISPLAY(prefix, type, obj) \
if ((obj) != nullptr) { \
if (auto *log_display_obj = (obj); log_display_obj != nullptr) { \
ESP_LOGCONFIG(TAG, \
prefix type "\n" \
"%s Rotations: %d °\n" \
"%s Dimensions: %dpx x %dpx", \
prefix, (obj)->rotation_, prefix, (obj)->get_width(), (obj)->get_height()); \
prefix, log_display_obj->rotation_, prefix, log_display_obj->get_width(), \
log_display_obj->get_height()); \
}
/// Turn the pixel OFF.