diff options
author | FChannel <> | 2021-06-29 17:20:43 -0700 |
---|---|---|
committer | FChannel <> | 2021-06-29 17:20:43 -0700 |
commit | d8ec39ca028dfed3e2c1ba0193c6fde977ae22b5 (patch) | |
tree | ed263bc8bc7eb31c7eab75962ad9d8261807c8c5 /client.go | |
parent | f404f8ff098674280231819958c9beedcdba6011 (diff) |
check for nil pointer reference
Diffstat (limited to 'client.go')
-rw-r--r-- | client.go | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -224,12 +224,13 @@ func PostGet(w http.ResponseWriter, r *http.Request, db *sql.DB){ } } else { collection := GetObjectByIDFromDB(db, inReplyTo) + if collection.Actor != nil { + returnData.Board.Post.Actor = collection.Actor.Id + returnData.Board.InReplyTo = inReplyTo - returnData.Board.Post.Actor = collection.Actor.Id - returnData.Board.InReplyTo = inReplyTo - - if len(collection.OrderedItems) > 0 { - returnData.Posts = append(returnData.Posts, collection.OrderedItems[0]) + if len(collection.OrderedItems) > 0 { + returnData.Posts = append(returnData.Posts, collection.OrderedItems[0]) + } } } |