Skip to content

Commit

Permalink
fix subscription data source ix
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Norton committed Feb 15, 2024
1 parent 424f469 commit 4e05d75
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions policy/data/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package data

import (
"context"
"fmt"

"olympos.io/encoding/edn"
)

Expand All @@ -28,8 +26,8 @@ func (ds SubscriptionDataSource) Query(_ context.Context, queryName string, _ st
return nil, nil
}

if ix >= len(ds.subscriptionResults) {
return nil, fmt.Errorf("can't get subscription query %s (index %d) from result length %d", queryName, ix, len(ds.subscriptionResults))
if len(ds.subscriptionResults) == 0 || ix >= len(ds.subscriptionResults[0]) {
return nil, nil
}

err := edn.Unmarshal(ds.subscriptionResults[0][ix], output)
Expand Down

0 comments on commit 4e05d75

Please sign in to comment.