From 86fbcfac83a82bc758874d100c860322bfb21f5b Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Sat, 10 Jun 2017 11:04:44 +0100 Subject: [PATCH] command/providers: Avoid crash when no configs found --- command/providers.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/command/providers.go b/command/providers.go index 3c1d144330..aeae44b15c 100644 --- a/command/providers.go +++ b/command/providers.go @@ -43,6 +43,13 @@ func (c *ProvidersCommand) Run(args []string) int { c.Ui.Error(fmt.Sprintf("Failed to load root config module: %s", err)) return 1 } + if root == nil { + c.Ui.Error(fmt.Sprintf( + "No configuration files found in the directory: %s\n\n"+ + "This command requires configuration to run.", + configPath)) + return 1 + } // Validate the config (to ensure the version constraints are valid) err = root.Validate()