[choice] Resolve textHandler pointer scoping

This commit is contained in:
Peter Feerick
2021-09-23 22:19:08 +10:00
parent 5ced0de44a
commit 672dc8389b
+4 -4
View File
@@ -106,17 +106,17 @@ void Choice::paint(BitmapBuffer * dc)
FormField::paint(dc); FormField::paint(dc);
auto val = getValue(); auto val = getValue();
const char* str = ""; std::string str = "";
if (textHandler) { if (textHandler) {
str = textHandler(val).c_str(); str = textHandler(val);
} else { } else {
val -= vmin; val -= vmin;
if (val >= 0 && val < (int)values.size()) { if (val >= 0 && val < (int)values.size()) {
str = values[val].c_str(); str = values[val];
} }
} }
theme->drawChoice(dc, this, str); theme->drawChoice(dc, this, str.c_str());
} }
#if defined(HARDWARE_KEYS) #if defined(HARDWARE_KEYS)