From afe628d62c587a52f22c23489d0455a4d67282ca Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 28 Oct 2025 14:59:42 -0500 Subject: [PATCH] test --- esphome/components/api/proto.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/esphome/components/api/proto.h b/esphome/components/api/proto.h index cc14fa1c8a..7809d15fea 100644 --- a/esphome/components/api/proto.h +++ b/esphome/components/api/proto.h @@ -230,10 +230,11 @@ class ProtoWriteBuffer { return; } - uint8_t *p = this->buffer_->data() + start; + uint8_t *p; if (value < 16384) { // 2 bytes this->buffer_->resize(start + 2); + p = this->buffer_->data() + start; p[0] = (value & 0x7F) | 0x80; p[1] = (value >> 7) & 0x7F; return; @@ -241,6 +242,7 @@ class ProtoWriteBuffer { if (value < 2097152) { // 3 bytes this->buffer_->resize(start + 3); + p = this->buffer_->data() + start; p[0] = (value & 0x7F) | 0x80; p[1] = ((value >> 7) & 0x7F) | 0x80; p[2] = (value >> 14) & 0x7F; @@ -249,6 +251,7 @@ class ProtoWriteBuffer { if (value < 268435456) { // 4 bytes this->buffer_->resize(start + 4); + p = this->buffer_->data() + start; p[0] = (value & 0x7F) | 0x80; p[1] = ((value >> 7) & 0x7F) | 0x80; p[2] = ((value >> 14) & 0x7F) | 0x80; @@ -274,6 +277,7 @@ class ProtoWriteBuffer { } this->buffer_->resize(start + size); + p = this->buffer_->data() + start; size_t bytes = 0; while (value) { uint8_t temp = value & 0x7F;