Skip to content

Commit 714f8c3

Browse files
committed
Cast from NaN to unsigned int is undefined behavior
#87 (comment)
1 parent 5a8dd74 commit 714f8c3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

esphome/nspanel_esphome_version.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ script:
114114
{"blueprint", version_blueprint->state.c_str() },
115115
{"min_blueprint_version", "${min_blueprint_version}"},
116116
{"esphome", "${version}"},
117-
{"tft", std::to_string(static_cast<unsigned int>(version_tft->state))},
117+
{"tft", std::isnan(version_tft->state) ?
118+
"0" :
119+
std::to_string(static_cast<unsigned int>(version_tft->state))},
118120
{"min_tft_version", "${min_tft_version}"},
119121
#ifdef NSPANEL_EASY_ADDON_UPLOAD_TFT
120122
{"upload_tft_installed", "true"},

0 commit comments

Comments
 (0)