Skip to content

Commit a6e383f

Browse files
committed
Fix nil response
1 parent 3eb9bbe commit a6e383f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

spine/function_data.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@ func (r *FunctionDataImpl[T]) Data() *T {
4242
// and newly assigned at any time otherwise we run into panics
4343
// because of invalid memory address or nil pointer dereference
4444
var copiedData T
45-
if r.data != nil {
46-
copiedData = *r.data
45+
if r.data == nil {
46+
return nil
4747
}
4848

49+
copiedData = *r.data
50+
4951
return &copiedData
5052
}
5153

0 commit comments

Comments
 (0)