[MIRROR] Fix jatum (#5962)

* Fix jatum (#59048)

Jatum was not hanling non assoc list very well, due to a try not throwing an error like it should. This fixes that

Note that jatum still cannot be 100% trusted with datum serialisation, as it bugs out in this specific case:

datum/a
      var/datum/b/a_datum
      var/list/datum/b/a_list_of_datum_b

if a_datum is in a_list_of_datum_b, jatum will not correctly deserialise the full list (as the reference is already seen)

The fix was tested for : https://github.com/tgstation/TerraGov-Marine-Corps/pull/6599

* Fix jatum

Co-authored-by: BraveMole <bsouchu@gmail.com>
This commit is contained in:
SkyratBot
2021-05-26 15:49:16 +01:00
committed by GitHub
co-authored by BraveMole
parent 019788b593
commit be81e740fa
+1 -3
View File
@@ -80,15 +80,13 @@
// Serialize all lists as dicts, list("a") and list("a" = null) can't be differentiated in DM
var/list_contents = list()
for(var/key in value)
var/got_l_value
var/l_value
try
l_value = value[key]
got_l_value = TRUE
catch
// Expected, indicates a flat list
if(got_l_value)
if(!isnull(l_value))
list_contents += list(list(
"key" = _jatum_serialize_value(key, seen_references),
"value" = _jatum_serialize_value(l_value, seen_references)