Skip to content

Commit b04594e

Browse files
Add battery request check for empty set
Requests with empty batteries set need to be rejected. Signed-off-by: Daniel Zullo <[email protected]>
1 parent cf30268 commit b04594e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/frequenz/sdk/actor/power_distributing/power_distributing.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,9 @@ def _check_request(self, request: Request) -> Optional[Result]:
388388
Returns:
389389
Result for the user if the request is wrong, None otherwise.
390390
"""
391+
if len(request.batteries) == 0:
392+
return Error(request=request, msg="Empty battery IDs in the request")
393+
391394
for battery in request.batteries:
392395
if battery not in self._battery_receivers:
393396
msg = (

0 commit comments

Comments
 (0)