Skip to content

Commit 36a9d35

Browse files
authored
fix: Fix nil pointer dereference when remaining rows not set (#1339)
If remaining rows is not set, it indicates an infinite number of remaining rows (ie. the plugin is free)
1 parent f174810 commit 36a9d35

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

premium/usage.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ func (u *BatchUpdater) HasQuota(ctx context.Context) (bool, error) {
227227
if usage.StatusCode() != http.StatusOK {
228228
return false, fmt.Errorf("failed to get usage: %s", usage.Status())
229229
}
230-
return *usage.JSON200.RemainingRows > 0, nil
230+
hasQuota := usage.JSON200.RemainingRows == nil || *usage.JSON200.RemainingRows > 0
231+
return hasQuota, nil
231232
}
232233

233234
func (u *BatchUpdater) Close() error {

0 commit comments

Comments
 (0)