[NPE] check that header exists, otherwise return empty string

This commit is contained in:
Evgeniy Kulikov 2020-03-16 18:34:13 +03:00
parent 3616987354
commit eab0a26cc0
No known key found for this signature in database
GPG key ID: BF6AEE0A2A699BF2

View file

@ -124,7 +124,12 @@ func (m *GetResponse) NotFull() bool { return checkIsNotFull(m) }
func (m *PutRequest) NotFull() bool { return checkIsNotFull(m) }
// CID returns container id value from object put request.
func (m *PutRequest) CID() CID { return m.GetHeader().Object.SystemHeader.CID }
func (m *PutRequest) CID() CID {
if header := m.GetHeader(); header != nil {
return header.Object.SystemHeader.CID
}
return refs.CID{}
}
// CID returns container id value from object get request.
func (m *GetRequest) CID() CID { return m.Address.CID }