1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

return immediately on error

Signed-off-by: Espen Suenson <mail@espensuenson.dk>
This commit is contained in:
Espen Suenson 2019-09-24 10:56:30 +02:00
parent 43a3151db2
commit a1ab732711

View file

@ -81,9 +81,12 @@ func (c *controller) getStores() []datastore.DataStore {
func (c *controller) getNetworkFromStore(nid string) (*network, error) {
ns, err := c.getNetworksFromStore()
if err != nil {
return nil, err
}
for _, n := range ns {
if n.id == nid {
return n, err
return n, nil
}
}
return nil, fmt.Errorf("network %s not found", nid)