Skip to content

Commit a348801

Browse files
Prevents the Future result from being set twice. (#1599)
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com> Co-authored-by: Nadav Elkabets <elnadav12@gmail.com>
1 parent c3ecefe commit a348801

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

rclpy/rclpy/action/server.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,15 +215,18 @@ def executing(self) -> None:
215215

216216
def succeed(self, response: Optional[ResultT] = None) -> None:
217217
self._update_state(_rclpy.GoalEvent.SUCCEED)
218-
self._set_result(response)
218+
if response is not None:
219+
self._set_result(response)
219220

220221
def abort(self, response: Optional[ResultT] = None) -> None:
221222
self._update_state(_rclpy.GoalEvent.ABORT)
222-
self._set_result(response)
223+
if response is not None:
224+
self._set_result(response)
223225

224226
def canceled(self, response: Optional[ResultT] = None) -> None:
225227
self._update_state(_rclpy.GoalEvent.CANCELED)
226-
self._set_result(response)
228+
if response is not None:
229+
self._set_result(response)
227230

228231
def destroy(self) -> None:
229232
with self._lock:

0 commit comments

Comments
 (0)