Ensure serializing nil as a pointer returns null
This commit is contained in:
parent
673a653200
commit
8100295567
1 changed files with 3 additions and 2 deletions
|
|
@ -323,13 +323,14 @@
|
||||||
|
|
||||||
(defmethod serialize* ::pointer
|
(defmethod serialize* ::pointer
|
||||||
[obj type scope]
|
[obj type scope]
|
||||||
(when-not (null? obj)
|
(if-not (null? obj)
|
||||||
(if (sequential? type)
|
(if (sequential? type)
|
||||||
(with-acquired [scope]
|
(with-acquired [scope]
|
||||||
(let [segment (alloc-instance (second type) scope)]
|
(let [segment (alloc-instance (second type) scope)]
|
||||||
(serialize-into obj (second type) segment scope)
|
(serialize-into obj (second type) segment scope)
|
||||||
(address-of segment)))
|
(address-of segment)))
|
||||||
obj)))
|
obj)
|
||||||
|
(MemoryAddress/NULL)))
|
||||||
|
|
||||||
(defmulti serialize-into
|
(defmulti serialize-into
|
||||||
"Writes a serialized version of the `obj` to the given `segment`.
|
"Writes a serialized version of the `obj` to the given `segment`.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue