Ensure serializing nil as a pointer returns null

This commit is contained in:
Joshua Suskalo 2021-10-01 12:03:25 -05:00
parent 673a653200
commit 8100295567

View file

@ -323,13 +323,14 @@
(defmethod serialize* ::pointer
[obj type scope]
(when-not (null? obj)
(if-not (null? obj)
(if (sequential? type)
(with-acquired [scope]
(let [segment (alloc-instance (second type) scope)]
(serialize-into obj (second type) segment scope)
(address-of segment)))
obj)))
obj)
(MemoryAddress/NULL)))
(defmulti serialize-into
"Writes a serialized version of the `obj` to the given `segment`.