drivermanager: don't store nil reattach configs

This commit is contained in:
Nick Ethier 2019-01-25 23:07:04 -05:00
parent 1f4c26e19e
commit 8d7a47340c
No known key found for this signature in database
GPG Key ID: 07C1A3ECED90D24A
1 changed files with 6 additions and 3 deletions

View File

@ -322,9 +322,12 @@ func (m *manager) storePluginReattachConfig(id loader.PluginID, c *plugin.Reatta
m.reattachConfigLock.Lock()
defer m.reattachConfigLock.Unlock()
// Store the new reattach config
m.reattachConfigs[id] = pstructs.ReattachConfigFromGoPlugin(c)
if c == nil {
delete(m.reattachConfigs, id)
} else {
// Store the new reattach config
m.reattachConfigs[id] = pstructs.ReattachConfigFromGoPlugin(c)
}
// Persist the state
s := &state.PluginState{
ReattachConfigs: make(map[string]*pstructs.ReattachConfig, len(m.reattachConfigs)),