Skip to content

Commit

Permalink
fix(backup): null pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
fiftin committed Feb 12, 2025
1 parent c97107a commit e693f31
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions services/project/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,15 @@ func (b *BackupDB) format() (*BackupFormat, error) {
Inventory, _ = findNameByID[db.Inventory](*o.InventoryID, b.inventories)
}

surveyVars := make([]db.SurveyVar, 0)
err := json.Unmarshal([]byte(*o.SurveyVarsJSON), &surveyVars)
if err != nil {
return nil, err
if o.SurveyVarsJSON != nil {
surveyVars := make([]db.SurveyVar, 0)
err := json.Unmarshal([]byte(*o.SurveyVarsJSON), &surveyVars)
if err != nil {
return nil, err
}
o.SurveyVars = surveyVars
}

o.SurveyVars = surveyVars

templates[i] = BackupTemplate{
Template: o,
View: View,
Expand Down

0 comments on commit e693f31

Please sign in to comment.