Skip to content

Commit

Permalink
fix: resources pipe cursor nil
Browse files Browse the repository at this point in the history
  • Loading branch information
kainonly committed Apr 17, 2023
1 parent d0c7d37 commit 436c68a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions resources/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ func (x *Service) Pipe(data M, keys []string, kind interface{}) (err error) {
n := len(keys) - 1
for i, key := range keys[:n] {
if key == "$" {
for _, value := range cursor.([]interface{}) {
if err = x.Pipe(value.(M), keys[i+1:], kind); err != nil {
for _, v := range cursor.([]interface{}) {
if err = x.Pipe(v.(M), keys[i+1:], kind); err != nil {
return
}
}
Expand All @@ -334,7 +334,7 @@ func (x *Service) Pipe(data M, keys []string, kind interface{}) (err error) {
cursor = cursor.(M)[key]
}
key := keys[n]
if cursor.(M)[key] == nil {
if cursor == nil || cursor.(M)[key] == nil {
return
}
switch kind {
Expand Down

0 comments on commit 436c68a

Please sign in to comment.