@@ -4718,7 +4718,7 @@ namespace jsoncons {
47184718 }
47194719 }
47204720
4721- expected<void ,std::error_code> try_dump_noflush (basic_json_visitor<char_type>& visitor, std::error_code& ec ) const
4721+ expected<void ,std::error_code> try_dump_noflush (basic_json_visitor<char_type>& visitor) const
47224722 {
47234723 std::error_code ec;
47244724 const ser_context context{};
@@ -4769,20 +4769,36 @@ namespace jsoncons {
47694769 {
47704770 visitor.key (string_view_type (((*it).key ()).data (),(*it).key ().length ()), context, ec);
47714771 (*it).value ().dump_noflush (visitor, ec);
4772+ if (JSONCONS_UNLIKELY (ec))
4773+ {
4774+ return expected<void ,std::error_code>{unexpect, ec};
4775+ }
47724776 }
47734777 visitor.end_object (context, ec);
4774- return ec ? expected<void ,std::error_code>{unexpect, ec} : expected<void ,std::error_code>{};
4778+ if (JSONCONS_UNLIKELY (ec))
4779+ {
4780+ return expected<void ,std::error_code>{unexpect, ec};
4781+ }
4782+ return expected<void ,std::error_code>{};
47754783 }
47764784 case json_storage_kind::array:
47774785 {
47784786 visitor.begin_array (size (), tag (), context, ec);
47794787 const array& o = cast<array_storage>().value ();
47804788 for (const_array_iterator it = o.begin (); it != o.end (); ++it)
47814789 {
4782- (*it).dump_noflush (visitor, ec);
4790+ auto r = (*it).try_dump_noflush (visitor);
4791+ if (JSONCONS_UNLIKELY (!r))
4792+ {
4793+ return r;
4794+ }
47834795 }
47844796 visitor.end_array (context, ec);
4785- return ec ? expected<void ,std::error_code>{unexpect, ec} : expected<void ,std::error_code>{};
4797+ if (JSONCONS_UNLIKELY (ec))
4798+ {
4799+ return expected<void ,std::error_code>{unexpect, ec};
4800+ }
4801+ return expected<void ,std::error_code>{};
47864802 }
47874803 case json_storage_kind::json_const_ref:
47884804 return cast<json_const_reference_storage>().value ().try_dump_noflush (visitor);
0 commit comments