Fix panic when determining if CKR is enabled

This commit is contained in:
Neil Alexander 2019-05-30 17:33:59 +01:00
parent e430d16018
commit f0422dbd8b
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944

View File

@ -115,12 +115,13 @@ func (c *cryptokey) configure() error {
// Enable or disable crypto-key routing. // Enable or disable crypto-key routing.
func (c *cryptokey) setEnabled(enabled bool) { func (c *cryptokey) setEnabled(enabled bool) {
c.enabled.Store(true) c.enabled.Store(enabled)
} }
// Check if crypto-key routing is enabled. // Check if crypto-key routing is enabled.
func (c *cryptokey) isEnabled() bool { func (c *cryptokey) isEnabled() bool {
return c.enabled.Load().(bool) enabled, ok := c.enabled.Load().(bool)
return ok && enabled
} }
// Check whether the given address (with the address length specified in bytes) // Check whether the given address (with the address length specified in bytes)