forked from BigfootDev/flatbuffers
Perform nil check on string fields when packing (#7719)
Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
@@ -14,7 +14,10 @@ type StatT struct {
|
||||
|
||||
func (t *StatT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
if t == nil { return 0 }
|
||||
idOffset := builder.CreateString(t.Id)
|
||||
idOffset := flatbuffers.UOffsetT(0)
|
||||
if t.Id != "" {
|
||||
idOffset = builder.CreateString(t.Id)
|
||||
}
|
||||
StatStart(builder)
|
||||
StatAddId(builder, idOffset)
|
||||
StatAddVal(builder, t.Val)
|
||||
|
||||
Reference in New Issue
Block a user