From bfb6490ec86629b28a13335c35676e7c0c594b75 Mon Sep 17 00:00:00 2001 From: Ray Bellis Date: Mon, 8 May 2023 13:19:47 +0100 Subject: [PATCH] fix dangling pointer error --- drivers/ltp305/ltp305.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/ltp305/ltp305.cpp b/drivers/ltp305/ltp305.cpp index 6a851a34..e6a61fc5 100644 --- a/drivers/ltp305/ltp305.cpp +++ b/drivers/ltp305/ltp305.cpp @@ -64,8 +64,8 @@ namespace pimoroni { } void LTP305::set_character(uint8_t x, uint16_t ch) { - uint8_t *data = nullptr; - for(auto c : dotfont) { + const uint8_t *data = nullptr; + for(const auto& c : dotfont) { if(c.code == ch) { data = &c.data[0]; break; @@ -128,4 +128,4 @@ namespace pimoroni { i2c->reg_write_uint8(address, CMD_BRIGHTNESS, brightness); i2c->reg_write_uint8(address, CMD_UPDATE, 0x01); } -} \ No newline at end of file +}