Skip to content

Commit

Permalink
fix some nil pointer errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rainu committed Jan 5, 2021
1 parent f1307c5 commit 5aea567
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ go build

## Release History

* 0.2.2
* Fix nil pointer error if there is a glacier job of type != "ArchiveRetrieval"
* Fix nil pointer error if upload failed
* 0.2.1
* CLI curator option for keeping n backups
* 0.2.0
Expand Down
4 changes: 1 addition & 3 deletions backup/glacier.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,7 @@ func (a *awsGlacier) determineJobId(vaultName, archiveId string) (*glacier.JobDe

LogInfo("Complete ListJobs: %+v", result)
for _, jobDesc := range result.JobList {
if *jobDesc.ArchiveId == archiveId &&
*jobDesc.Action == "ArchiveRetrieval" {

if *jobDesc.Action == "ArchiveRetrieval" && *jobDesc.ArchiveId == archiveId {
return jobDesc, nil
}
}
Expand Down
9 changes: 6 additions & 3 deletions backup/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,15 @@ func (b *backupManager) updateBackup(result *BackupResult, dbBackupEntity *model
if result.Error != nil {
dbBackupEntity.Error = result.Error.Error()
}
dbBackupEntity.ArchiveId = result.ArchiveInfo.ArchiveId
dbBackupEntity.UploadId = result.UploadId
dbBackupEntity.Checksum = result.ArchiveInfo.Checksum
dbBackupEntity.Location = result.ArchiveInfo.Location
dbBackupEntity.Length = result.TotalSize

if result.ArchiveInfo != nil {
dbBackupEntity.ArchiveId = result.ArchiveInfo.ArchiveId
dbBackupEntity.Checksum = result.ArchiveInfo.Checksum
dbBackupEntity.Location = result.ArchiveInfo.Location
}

b.dbRepository.UpdateBackup(dbBackupEntity)
}

Expand Down

0 comments on commit 5aea567

Please sign in to comment.