Skip to content

Commit 26dcf39

Browse files
committed
Bugfix: RPC: Don't use a continuation elipsis after an elision elipsis
1 parent eca65ca commit 26dcf39

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/rpc/util.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -643,10 +643,10 @@ void RPCResult::ToSections(Sections& sections, const OuterType outer_type, const
643643
for (const auto& i : m_inner) {
644644
i.ToSections(sections, OuterType::ARR, current_indent + 2);
645645
}
646-
if (m_type == Type::ARR) {
646+
CHECK_NONFATAL(!m_inner.empty());
647+
if (m_type == Type::ARR && m_inner.back().m_type != Type::ELISION) {
647648
sections.PushSection({indent_next + "...", ""});
648649
} else {
649-
CHECK_NONFATAL(!m_inner.empty());
650650
// Remove final comma, which would be invalid JSON
651651
sections.m_sections.back().m_left.pop_back();
652652
}
@@ -659,11 +659,11 @@ void RPCResult::ToSections(Sections& sections, const OuterType outer_type, const
659659
for (const auto& i : m_inner) {
660660
i.ToSections(sections, OuterType::OBJ, current_indent + 2);
661661
}
662-
if (m_type == Type::OBJ_DYN) {
662+
CHECK_NONFATAL(!m_inner.empty());
663+
if (m_type == Type::OBJ_DYN && m_inner.back().m_type != Type::ELISION) {
663664
// If the dictionary keys are dynamic, use three dots for continuation
664665
sections.PushSection({indent_next + "...", ""});
665666
} else {
666-
CHECK_NONFATAL(!m_inner.empty());
667667
// Remove final comma, which would be invalid JSON
668668
sections.m_sections.back().m_left.pop_back();
669669
}

0 commit comments

Comments
 (0)