forked from TrueCloudLab/frostfs-api-go
Merge pull request #61 from nspcc-dev/fix-putrequest-cid-npe
Fix NPE in PutRequest.CID()
This commit is contained in:
commit
4f6121986e
2 changed files with 5 additions and 1 deletions
|
@ -127,7 +127,9 @@ func (m *PutRequest) NotFull() bool { return checkIsNotFull(m) }
|
||||||
// CID returns container id value from object put request.
|
// CID returns container id value from object put request.
|
||||||
func (m *PutRequest) CID() CID {
|
func (m *PutRequest) CID() CID {
|
||||||
if header := m.GetHeader(); header != nil {
|
if header := m.GetHeader(); header != nil {
|
||||||
return header.Object.SystemHeader.CID
|
if obj := header.GetObject(); obj != nil {
|
||||||
|
return obj.SystemHeader.CID
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return refs.CID{}
|
return refs.CID{}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ func TestRequest(t *testing.T) {
|
||||||
&DeleteRequest{},
|
&DeleteRequest{},
|
||||||
&GetRangeRequest{},
|
&GetRangeRequest{},
|
||||||
&GetRangeHashRequest{},
|
&GetRangeHashRequest{},
|
||||||
|
MakePutRequestHeader(nil, nil),
|
||||||
}
|
}
|
||||||
|
|
||||||
types := []RequestType{
|
types := []RequestType{
|
||||||
|
@ -26,6 +27,7 @@ func TestRequest(t *testing.T) {
|
||||||
RequestDelete,
|
RequestDelete,
|
||||||
RequestRange,
|
RequestRange,
|
||||||
RequestRangeHash,
|
RequestRangeHash,
|
||||||
|
RequestPut,
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := range cases {
|
for i := range cases {
|
||||||
|
|
Loading…
Reference in a new issue