diff --git a/cryptex.go b/cryptex.go index d8296e7..ed66058 100644 --- a/cryptex.go +++ b/cryptex.go @@ -10,6 +10,7 @@ import ( "io/ioutil" "os" "os/exec" + "fmt" ) const ( @@ -196,6 +197,9 @@ func (c *Cryptex) Decrypt(d *Container) (interface{}, error) { } func (c *Cryptex) Edit(i *Container) (interface{}, error) { + if i == nil || i.Values == nil { + return nil, fmt.Errorf("container is empty") + } p, err := c.decrypt(i.Values) if err != nil { return nil, err