aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/util.cpp
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2020-04-02 15:22:55 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2020-04-02 15:24:01 +0000
commit26dcf3958187cbdc9ffc9438a5eebfcaf607f7e9 (patch)
tree10801f65ba72b38d274c6b2faa1dc3487122a3a4 /src/rpc/util.cpp
parenteca65caadcddf43b2dace111bd7e4b0a2a9556c2 (diff)
Bugfix: RPC: Don't use a continuation elipsis after an elision elipsis
Diffstat (limited to 'src/rpc/util.cpp')
-rw-r--r--src/rpc/util.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp
index f7038aba8f..c1f46f224b 100644
--- a/src/rpc/util.cpp
+++ b/src/rpc/util.cpp
@@ -643,10 +643,10 @@ void RPCResult::ToSections(Sections& sections, const OuterType outer_type, const
for (const auto& i : m_inner) {
i.ToSections(sections, OuterType::ARR, current_indent + 2);
}
- if (m_type == Type::ARR) {
+ CHECK_NONFATAL(!m_inner.empty());
+ if (m_type == Type::ARR && m_inner.back().m_type != Type::ELISION) {
sections.PushSection({indent_next + "...", ""});
} else {
- CHECK_NONFATAL(!m_inner.empty());
// Remove final comma, which would be invalid JSON
sections.m_sections.back().m_left.pop_back();
}
@@ -659,11 +659,11 @@ void RPCResult::ToSections(Sections& sections, const OuterType outer_type, const
for (const auto& i : m_inner) {
i.ToSections(sections, OuterType::OBJ, current_indent + 2);
}
- if (m_type == Type::OBJ_DYN) {
+ CHECK_NONFATAL(!m_inner.empty());
+ if (m_type == Type::OBJ_DYN && m_inner.back().m_type != Type::ELISION) {
// If the dictionary keys are dynamic, use three dots for continuation
sections.PushSection({indent_next + "...", ""});
} else {
- CHECK_NONFATAL(!m_inner.empty());
// Remove final comma, which would be invalid JSON
sections.m_sections.back().m_left.pop_back();
}