Skip to content

Commit

Permalink
Convert: return nil when detector is empty
Browse files Browse the repository at this point in the history
When PotentialNamespace is used detector is empty and
DetectorFromDatabaseModel() should return nil instead of empty object.
  • Loading branch information
Allda committed Mar 20, 2019
1 parent f326b6f commit f2ce832
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/v3/clairpb/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ func NamespacedFeatureFromDatabaseModel(feature database.AncestryFeature) *Featu

// DetectorFromDatabaseModel converts database detector to api detector.
func DetectorFromDatabaseModel(detector database.Detector) *Detector {
if !detector.Valid() {
return nil
}
return &Detector{
Name: detector.Name,
Version: detector.Version,
Expand Down

0 comments on commit f2ce832

Please sign in to comment.