Guard the honored board_build branch against the empty-list form

voluptuous accepts [] for [cv.string], so vals[-1] could raise an
IndexError at codegen time; an empty list now falls through to the
ignored-option warning.
This commit is contained in:
J. Nick Koston
2026-08-22 13:51:35 -05:00
parent 2dac9112be
commit 2f053371ce
2 changed files with 12 additions and 3 deletions
+4
View File
@@ -1423,6 +1423,10 @@ async def test_add_platformio_options_native_arduino(
assert (
"esphome->platformio_options->board_build.filesystem is ignored" in caplog.text
)
# An empty list for an honored key is not a scalar; it falls through
# to the ignored-option warning instead of an IndexError
await config._add_platformio_options({"board_build.ldscript": []})
assert "board_build.ldscript is ignored" in caplog.text
assert "'arduino' toolchain" in caplog.text
assert "upload_speed" not in caplog.text