forked from TrueCloudLab/frostfs-api-go
[#51] *: Do not panic in StableSize()
After #49 it can be called on nil structures. Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
3072090c77
commit
964c3edb3f
2 changed files with 20 additions and 0 deletions
|
@ -30,6 +30,10 @@ func (x *Detail) StableMarshal(buf []byte) []byte {
|
|||
}
|
||||
|
||||
func (x *Detail) StableSize() (size int) {
|
||||
if x == nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
size += protoutil.UInt32Size(detailIDFNum, x.id)
|
||||
size += protoutil.BytesSize(detailValueFNum, x.val)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue