mirror of https://github.com/databricks/cli.git
Check for nil environment before accessing it (#453)
This commit is contained in:
parent
4818541062
commit
894d25e434
|
@ -78,6 +78,9 @@ func (r *Root) SetConfigFilePath(path string) {
|
|||
r.Resources.SetConfigFilePath(path)
|
||||
if r.Environments != nil {
|
||||
for _, env := range r.Environments {
|
||||
if env == nil {
|
||||
continue
|
||||
}
|
||||
if env.Resources != nil {
|
||||
env.Resources.SetConfigFilePath(path)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
bundle:
|
||||
name: environment_empty
|
||||
|
||||
environments:
|
||||
development:
|
|
@ -0,0 +1,12 @@
|
|||
package config_tests
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestEnvironmentEmpty(t *testing.T) {
|
||||
b := loadEnvironment(t, "./environment_empty", "development")
|
||||
assert.Equal(t, "development", b.Config.Bundle.Environment)
|
||||
}
|
Loading…
Reference in New Issue