forked from TrueCloudLab/rclone
acd: Fix nil pointer deref - fixes #916
This commit is contained in:
parent
7929b6e756
commit
05798672c8
1 changed files with 6 additions and 3 deletions
|
@ -819,7 +819,7 @@ func (o *Object) Hash(t fs.HashType) (string, error) {
|
||||||
if t != fs.HashMD5 {
|
if t != fs.HashMD5 {
|
||||||
return "", fs.ErrHashUnsupported
|
return "", fs.ErrHashUnsupported
|
||||||
}
|
}
|
||||||
if o.info.ContentProperties.Md5 != nil {
|
if o.info.ContentProperties != nil && o.info.ContentProperties.Md5 != nil {
|
||||||
return *o.info.ContentProperties.Md5, nil
|
return *o.info.ContentProperties.Md5, nil
|
||||||
}
|
}
|
||||||
return "", nil
|
return "", nil
|
||||||
|
@ -827,8 +827,11 @@ func (o *Object) Hash(t fs.HashType) (string, error) {
|
||||||
|
|
||||||
// Size returns the size of an object in bytes
|
// Size returns the size of an object in bytes
|
||||||
func (o *Object) Size() int64 {
|
func (o *Object) Size() int64 {
|
||||||
|
if o.info.ContentProperties != nil && o.info.ContentProperties.Size != nil {
|
||||||
return int64(*o.info.ContentProperties.Size)
|
return int64(*o.info.ContentProperties.Size)
|
||||||
}
|
}
|
||||||
|
return 0 // Object is likely PENDING
|
||||||
|
}
|
||||||
|
|
||||||
// readMetaData gets the metadata if it hasn't already been fetched
|
// readMetaData gets the metadata if it hasn't already been fetched
|
||||||
//
|
//
|
||||||
|
@ -1108,7 +1111,7 @@ OnConflict:
|
||||||
|
|
||||||
// MimeType of an Object if known, "" otherwise
|
// MimeType of an Object if known, "" otherwise
|
||||||
func (o *Object) MimeType() string {
|
func (o *Object) MimeType() string {
|
||||||
if o.info.ContentProperties.ContentType != nil {
|
if o.info.ContentProperties != nil && o.info.ContentProperties.ContentType != nil {
|
||||||
return *o.info.ContentProperties.ContentType
|
return *o.info.ContentProperties.ContentType
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
|
|
Loading…
Reference in a new issue