forked from lix-project/lix
AttrCursor::getStringWithContext(): Force re-evaluation if the cached context is not valid
Fixes #4236.
This commit is contained in:
parent
0327580e54
commit
4dcb183af3
|
@ -525,8 +525,17 @@ string_t AttrCursor::getStringWithContext()
|
||||||
cachedValue = root->db->getAttr(getKey(), root->state.symbols);
|
cachedValue = root->db->getAttr(getKey(), root->state.symbols);
|
||||||
if (cachedValue && !std::get_if<placeholder_t>(&cachedValue->second)) {
|
if (cachedValue && !std::get_if<placeholder_t>(&cachedValue->second)) {
|
||||||
if (auto s = std::get_if<string_t>(&cachedValue->second)) {
|
if (auto s = std::get_if<string_t>(&cachedValue->second)) {
|
||||||
debug("using cached string attribute '%s'", getAttrPathStr());
|
bool valid = true;
|
||||||
return *s;
|
for (auto & c : s->second) {
|
||||||
|
if (!root->state.store->isValidPath(root->state.store->parseStorePath(c.first))) {
|
||||||
|
valid = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (valid) {
|
||||||
|
debug("using cached string attribute '%s'", getAttrPathStr());
|
||||||
|
return *s;
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
throw TypeError("'%s' is not a string", getAttrPathStr());
|
throw TypeError("'%s' is not a string", getAttrPathStr());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue