From cb036f4dd2e8ff43630aa677ee0cb226f053da38 Mon Sep 17 00:00:00 2001 From: Chris O'Hara Date: Tue, 25 Jun 2024 11:16:37 +1000 Subject: [PATCH] Work around a NPE in coroutine serialization layer --- serde.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/serde.go b/serde.go index 43c2b61..65f034c 100644 --- a/serde.go +++ b/serde.go @@ -17,7 +17,16 @@ type serializedDispatch struct { } func dispatchSerializer(s *types.Serializer, d *Dispatch) error { - types.SerializeT(s, serializedDispatch{d.opts, d.functions}) + opts := make([]Option, 0, len(d.opts)) + for _, opt := range d.opts { + if _, ok := opt.(AnyFunction); ok { + // No need to serialize these options, since we serialize the + // map of registered functions directly. + continue + } + opts = append(opts, opt) + } + types.SerializeT(s, serializedDispatch{opts, d.functions}) return nil }