commands: Fix panic on invalid config in "hugo mod get" and similar

Fixes #8773
This commit is contained in:
Bjørn Erik Pedersen 2021-07-20 18:23:09 +02:00
parent d831d2fce8
commit 351ed0f569
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F

View file

@ -308,7 +308,7 @@ func (c *commandeer) loadConfig(mustHaveConfigFile, running bool) error {
cfgSetAndInit,
doWithConfig)
if err != nil && mustHaveConfigFile {
if err != nil {
return err
} else if mustHaveConfigFile && len(configFiles) == 0 {
return hugolib.ErrNoConfigFile