Skip to content

Commit 8fe4c66

Browse files
committed
Check for undefined fact before rendering it
1 parent 5f6aab2 commit 8fe4c66

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/osd.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,6 @@ class TplTextWidget: public Widget {
849849
uint precision = default_precision;
850850
int fact_i = 0;
851851
std::ostringstream msg;
852-
std::string precision_str;
853852
for(char& c : tpl) {
854853
if (c == '%') {
855854
at_placeholder = true;
@@ -868,7 +867,12 @@ class TplTextWidget: public Widget {
868867
msg << '?'; // Handle out-of-bounds fact access
869868
break;
870869
}
871-
const Fact& fact = args[fact_i];
870+
const Fact& fact = args.at(fact_i);
871+
if (!fact.isDefined()) {
872+
msg << '?';
873+
fact_i++;
874+
continue;
875+
}
872876
switch (c) {
873877
case 'b':
874878
msg << (fact.getBoolValue() ? 't' : 'f');

0 commit comments

Comments
 (0)