From b54c7de48c932944accff57be53219fa4b7f775d Mon Sep 17 00:00:00 2001 From: Brian Tiger Chow Date: Mon, 12 Jan 2015 18:17:12 -0800 Subject: [PATCH] fix(fsrepo): add guard to ConfigKey methods --- repo/fsrepo/fsrepo.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/repo/fsrepo/fsrepo.go b/repo/fsrepo/fsrepo.go index fa32d93d6..d1bcfb823 100644 --- a/repo/fsrepo/fsrepo.go +++ b/repo/fsrepo/fsrepo.go @@ -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