Merge pull request #58 from chantra/rtattr_data_children

[nl] Fix RtAttr.Serialize to serialize both Data and Children
This commit is contained in:
Vish Ishaya 2015-10-27 17:51:08 -07:00
commit 09c697082a

View File

@ -149,10 +149,12 @@ func (a *RtAttr) Serialize() []byte {
length := a.Len()
buf := make([]byte, rtaAlignOf(length))
next := 4
if a.Data != nil {
copy(buf[4:], a.Data)
} else {
next := 4
copy(buf[next:], a.Data)
next += rtaAlignOf(len(a.Data))
}
if len(a.children) > 0 {
for _, child := range a.children {
childBuf := child.Serialize()
copy(buf[next:], childBuf)