Add error checking for calling CreateVariations with no variants
Calling CreateVariations with no variants will corrupt the modules list with a module with nil logicModule, panic early with a useful message instead. Change-Id: Ic5c921efcba70c54efb5bb21a9626b2999376a69
This commit is contained in:
parent
bc21793f6c
commit
f4d18a685d
1 changed files with 5 additions and 0 deletions
|
@ -718,6 +718,11 @@ func (c *Context) processSubdirs(
|
|||
func (c *Context) createVariations(origModule *moduleInfo, mutatorName string,
|
||||
variationNames []string) ([]*moduleInfo, []error) {
|
||||
|
||||
if len(variationNames) == 0 {
|
||||
panic(fmt.Errorf("mutator %q passed zero-length variation list for module %q",
|
||||
mutatorName, origModule.properties.Name))
|
||||
}
|
||||
|
||||
newModules := []*moduleInfo{}
|
||||
|
||||
var errs []error
|
||||
|
|
Loading…
Reference in a new issue