summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2021-03-08 22:08:22 +0000
committerArne Juul <arnej@verizonmedia.com>2021-03-08 22:08:22 +0000
commitf17590a19f8596ee7ebfbccc6534e2f5044dabf3 (patch)
treec2e407898722c639c556c4090f57d1ae1012f9df
parentf1623b5c93bc7061fe54ddcf6daff69580354395 (diff)
check result after make_type instead
-rw-r--r--eval/src/vespa/eval/eval/value_codec.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/eval/src/vespa/eval/eval/value_codec.cpp b/eval/src/vespa/eval/eval/value_codec.cpp
index 98dc16aff66..bf45f34fd64 100644
--- a/eval/src/vespa/eval/eval/value_codec.cpp
+++ b/eval/src/vespa/eval/eval/value_codec.cpp
@@ -117,12 +117,12 @@ ValueType decode_type(nbostream &input, const Format &format) {
dim_list.emplace_back(name, input.getInt1_4Bytes());
}
}
- if (dim_list.empty() && (cell_type != CellType::DOUBLE)) {
- throw IllegalArgumentException(fmt("Scalar values must have cell type DOUBLE (was %u)",
- (uint32_t)cell_type));
-
+ auto result = ValueType::make_type(cell_type, std::move(dim_list));
+ if (result.is_error()) {
+ throw IllegalArgumentException(fmt("Invalid type (with %zu dimensions and cell type %u)",
+ dim_list.size(), (uint32_t)cell_type));
}
- return ValueType::make_type(cell_type, std::move(dim_list));
+ return result;
}
size_t maybe_decode_num_blocks(nbostream &input, bool has_mapped_dims, const Format &format) {