Skip to content

Commit bfb6490

Browse files
committed
fix dangling pointer error
1 parent 32dfdc6 commit bfb6490

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/ltp305/ltp305.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ namespace pimoroni {
6464
}
6565

6666
void LTP305::set_character(uint8_t x, uint16_t ch) {
67-
uint8_t *data = nullptr;
68-
for(auto c : dotfont) {
67+
const uint8_t *data = nullptr;
68+
for(const auto& c : dotfont) {
6969
if(c.code == ch) {
7070
data = &c.data[0];
7171
break;
@@ -128,4 +128,4 @@ namespace pimoroni {
128128
i2c->reg_write_uint8(address, CMD_BRIGHTNESS, brightness);
129129
i2c->reg_write_uint8(address, CMD_UPDATE, 0x01);
130130
}
131-
}
131+
}

0 commit comments

Comments
 (0)