check for etag header only if resp is not nil
diff --git a/openstack/objectstorage/v1/objects/requests.go b/openstack/objectstorage/v1/objects/requests.go
index 531d233..01e0b81 100644
--- a/openstack/objectstorage/v1/objects/requests.go
+++ b/openstack/objectstorage/v1/objects/requests.go
@@ -233,10 +233,10 @@
resp, err := c.Request("PUT", url, ropts)
if resp != nil {
res.Header = resp.Header
- }
- if resp.Header.Get("ETag") == fmt.Sprintf("%x", localChecksum) {
- res.Err = err
- break
+ if resp.Header.Get("ETag") == fmt.Sprintf("%x", localChecksum) {
+ res.Err = err
+ break
+ }
}
if i == 3 {
res.Err = fmt.Errorf("Local checksum does not match API ETag header")