From 7a95af6db29f4a481e5cf33735925171aeacc507 Mon Sep 17 00:00:00 2001 From: Noah Metz Date: Tue, 11 Jul 2023 00:23:07 -0600 Subject: [PATCH] Added nil check to deserializeinfo --- thread.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/thread.go b/thread.go index ec84a29..89e81f0 100644 --- a/thread.go +++ b/thread.go @@ -366,14 +366,17 @@ func RestoreSimpleThread(ctx *Context, thread Thread, j SimpleThreadJSON, nodes return fmt.Errorf("%+v is not a Thread as expected", child_node) } - info_ser, err := json.Marshal(info_raw) - if err != nil { - return err - } + var parsed_info ThreadInfo + if info_raw != nil { + info_ser, err := json.Marshal(info_raw) + if err != nil { + return err + } - parsed_info, err := thread.DeserializeInfo(ctx, info_ser) - if err != nil { - return err + parsed_info, err = thread.DeserializeInfo(ctx, info_ser) + if err != nil { + return err + } } thread.AddChild(child_t, parsed_info)