Skip to content

Commit bbfa933

Browse files
committed
fix: compile-time panic when .sample is called on a array-like resource (e.g. users)
Example: `users.where(false).sample()`
1 parent 13e4150 commit bbfa933

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mqlc/builtin_resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func compileResourceSample(c *compiler, typ types.Type, ref uint64, id string, c
199199
return types.Nil, multierr.Wrap(err, "failed to compile "+id)
200200
}
201201

202-
if call == nil {
202+
if call == nil || len(call.Function) == 0 {
203203
return types.Nil, errors.New("missing argument for calling '" + id + "'")
204204
}
205205
if len(call.Function) > 1 {

0 commit comments

Comments
 (0)