Convert: return nil when detector is empty
When PotentialNamespace is used detector is empty and DetectorFromDatabaseModel() should return nil instead of empty object.
This commit is contained in:
parent
f326b6f664
commit
f2ce8325b9
@ -153,6 +153,9 @@ func NamespacedFeatureFromDatabaseModel(feature database.AncestryFeature) *Featu
|
|||||||
|
|
||||||
// DetectorFromDatabaseModel converts database detector to api detector.
|
// DetectorFromDatabaseModel converts database detector to api detector.
|
||||||
func DetectorFromDatabaseModel(detector database.Detector) *Detector {
|
func DetectorFromDatabaseModel(detector database.Detector) *Detector {
|
||||||
|
if !detector.Valid() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return &Detector{
|
return &Detector{
|
||||||
Name: detector.Name,
|
Name: detector.Name,
|
||||||
Version: detector.Version,
|
Version: detector.Version,
|
||||||
|
Loading…
Reference in New Issue
Block a user