Avoid null slice being null in JSON

This commit is contained in:
Kota Kanbe
2017-02-16 17:59:15 +09:00
parent d6f72ac0f3
commit 55b1264c7d
4 changed files with 38 additions and 6 deletions

View File

@@ -287,6 +287,11 @@ func (l *base) convertToModel() models.ScanResult {
errs = append(errs, fmt.Sprintf("%s", e))
}
// Avoid null slice being null in JSON
for i := range l.VulnInfos {
l.VulnInfos[i].NilSliceToEmpty()
}
return models.ScanResult{
ServerName: l.ServerInfo.ServerName,
ScannedAt: time.Now(),