fix write generic helper

This commit is contained in:
Pavel Merzlyakov 2023-09-01 17:21:04 +03:00
parent 03c024c1a8
commit 11e46da3ce
1 changed files with 2 additions and 2 deletions

View File

@ -29,7 +29,7 @@ func ReadGeneric(r Reader, createFunc StructFactory, field string) (Readable, er
} }
func WriteGeneric(w Writer, s WritableClass, field string) error { func WriteGeneric(w Writer, s WritableClass, field string) error {
if err := w.BeginCollection(s.FieldsCount()+1, field); err != nil { if err := w.BeginContainer(s.FieldsCount()+1, field); err != nil {
return err return err
} }
if err := w.WriteUint32(s.ClassId(), classField); err != nil { if err := w.WriteUint32(s.ClassId(), classField); err != nil {
@ -38,5 +38,5 @@ func WriteGeneric(w Writer, s WritableClass, field string) error {
if err := s.WriteFields(w); err != nil { if err := s.WriteFields(w); err != nil {
return err return err
} }
return w.EndCollection() return w.EndContainer()
} }