diff --git a/include/api/dual_abi_helper.h b/include/api/dual_abi_helper.h index f94a3daa88..7d56d5ac72 100644 --- a/include/api/dual_abi_helper.h +++ b/include/api/dual_abi_helper.h @@ -32,13 +32,15 @@ inline std::vector StringToChar(const std::string &s) { return std::vector inline std::string CharToString(const std::vector &c) { return std::string(c.begin(), c.end()); } inline std::optional> OptionalStringToChar(const std::optional &s) { + if (s == std::nullopt) return std::nullopt; std::optional> ret = std::vector(s->begin(), s->end()); - return (s == std::nullopt) ? std::nullopt : ret; + return ret; } inline std::optional OptionalCharToString(const std::optional> &c) { + if (c == std::nullopt) return std::nullopt; std::optional ret = std::string(c->begin(), c->end()); - return (c == std::nullopt) ? std::nullopt : ret; + return ret; } inline std::pair, int32_t> PairStringToChar(const std::pair &s) {