From be81e740fa14e94cb49c92f60ccf773b6f0d0dfe Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Wed, 26 May 2021 16:49:16 +0200 Subject: [PATCH] [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 --- code/__HELPERS/jatum.dm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/code/__HELPERS/jatum.dm b/code/__HELPERS/jatum.dm index aaea50e8f4b..25cdf22fd57 100644 --- a/code/__HELPERS/jatum.dm +++ b/code/__HELPERS/jatum.dm @@ -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)