diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-12-04 11:00:35 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-12-04 11:00:35 +0000 |
commit | 93f496fe7fa9ddd76821d15b99c6974b78f15af0 (patch) | |
tree | 813913292e47fd20bfabb10240d77c0d13209cb7 | |
parent | 275ac97c80b786958962c77bdd6cc731bce87872 (diff) |
If there is error return an empty string.
-rw-r--r-- | searchlib/src/vespa/searchlib/attribute/integerbase.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/integerbase.cpp b/searchlib/src/vespa/searchlib/attribute/integerbase.cpp index 2f4fb899f8f..c288d0507d7 100644 --- a/searchlib/src/vespa/searchlib/attribute/integerbase.cpp +++ b/searchlib/src/vespa/searchlib/attribute/integerbase.cpp @@ -62,7 +62,11 @@ IntegerAttribute::getString(DocId doc, char * s, size_t sz) const { if (sz > 1) { largeint_t v = getInt(doc); auto res = std::to_chars(s, s + sz - 1, v, 10); - res.ptr[0] = 0; + if (res.ec == std::errc()) { + res.ptr[0] = 0; + } else { + s[0] = 0; + } } return s; } |