From 4fc9a4039d45071124a435121642ca396a8237c0 Mon Sep 17 00:00:00 2001 From: Jonas L Date: Wed, 19 Jun 2024 12:01:24 +0200 Subject: [PATCH] feat: filter out nil actions in action waiter (#464) Filter out nil actions, to help users of the function. --- hcloud/action_waiter.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hcloud/action_waiter.go b/hcloud/action_waiter.go index ebfe8ef4..53671fac 100644 --- a/hcloud/action_waiter.go +++ b/hcloud/action_waiter.go @@ -21,6 +21,9 @@ var _ ActionWaiter = (*ActionClient)(nil) // // The handleUpdate callback is called every time an action is updated. func (c *ActionClient) WaitForFunc(ctx context.Context, handleUpdate func(update *Action) error, actions ...*Action) error { + // Filter out nil actions + actions = slices.DeleteFunc(actions, func(a *Action) bool { return a == nil }) + running := make(map[int64]struct{}, len(actions)) for _, action := range actions { if action.Status == ActionStatusRunning {