aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--prog/rand.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/prog/rand.go b/prog/rand.go
index c1ac76776..e4164b74a 100644
--- a/prog/rand.go
+++ b/prog/rand.go
@@ -265,7 +265,8 @@ func (r *randGen) createResource(s *state, res *ResourceType) (arg Arg, calls []
defer func() { r.inCreateResource = false }()
kind := res.Desc.Name
- if r.oneOf(1000) {
+ // We may have no resources, but still be in createResource due to ANYRES.
+ if len(r.target.resourceMap) != 0 && r.oneOf(1000) {
// Spoof resource subkind.
var all []string
for kind1 := range r.target.resourceMap {
@@ -273,6 +274,10 @@ func (r *randGen) createResource(s *state, res *ResourceType) (arg Arg, calls []
all = append(all, kind1)
}
}
+ if len(all) == 0 {
+ panic(fmt.Sprintf("got no spoof resources for %v in %v/%v",
+ kind, r.target.OS, r.target.Arch))
+ }
sort.Strings(all)
kind = all[r.Intn(len(all))]
}