diff options
Diffstat (limited to 'core/variant')
-rw-r--r-- | core/variant/variant_parser.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/variant/variant_parser.cpp b/core/variant/variant_parser.cpp index 571181f665..57875bf50f 100644 --- a/core/variant/variant_parser.cpp +++ b/core/variant/variant_parser.cpp @@ -1649,12 +1649,13 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str dict.get_key_list(&keys); keys.sort(); + if (keys.is_empty()) { // Avoid unnecessary line break. + p_store_string_func(p_store_string_ud, "{}"); + break; + } + p_store_string_func(p_store_string_ud, "{\n"); for (List<Variant>::Element *E = keys.front(); E; E = E->next()) { - /* - if (!_check_type(dict[E->get()])) - continue; - */ write(E->get(), p_store_string_func, p_store_string_ud, p_encode_res_func, p_encode_res_ud, recursion_count); p_store_string_func(p_store_string_ud, ": "); write(dict[E->get()], p_store_string_func, p_store_string_ud, p_encode_res_func, p_encode_res_ud, recursion_count); |