提交 b54c7de4 作者: Brian Tiger Chow

fix(fsrepo): add guard to ConfigKey methods

上级 3986af76
......@@ -110,6 +110,9 @@ func (r *FSRepo) SetConfig(conf *config.Config) error {
// GetConfigKey retrieves only the value of a particular key
func (r *FSRepo) GetConfigKey(key string) (interface{}, error) {
if r.state != opened {
return nil, debugerror.Errorf("repo is %s", r.state)
}
filename, err := config.Filename(r.path)
if err != nil {
return nil, err
......@@ -123,6 +126,9 @@ func (r *FSRepo) GetConfigKey(key string) (interface{}, error) {
// SetConfigKey writes the value of a particular key
func (r *FSRepo) SetConfigKey(key string, value interface{}) error {
if r.state != opened {
return debugerror.Errorf("repo is %s", r.state)
}
filename, err := config.Filename(r.path)
if err != nil {
return err
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论