Skip to content

Commit 7080bd9

Browse files
committed
Check data type for action callback
1 parent afa5e4a commit 7080bd9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/core/Action.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,10 @@ class Action extends EventEmitter2 {
151151
*
152152
* @param {Object} rosbridgeRequest - The ROSLIB.ActionGoal to send.
153153
* @param {string} rosbridgeRequest.id - The ID of the action goal.
154+
* @param {TGoal} rosbridgeRequest.args - The arguments of the action goal.
154155
*/
155156
_executeAction(rosbridgeRequest) {
156-
var id;
157-
if (rosbridgeRequest.id) {
158-
id = rosbridgeRequest.id;
159-
}
157+
var id = rosbridgeRequest.id;
160158

161159
// If a cancellation callback exists, call it when a cancellation event is emitted.
162160
if (typeof id === 'string') {
@@ -167,9 +165,11 @@ class Action extends EventEmitter2 {
167165
});
168166
}
169167

170-
// Call the goal execution function provided.
171-
// @ts-expect-error -- possibly null
172-
this._actionCallback(rosbridgeRequest.args, id);
168+
// Call the action goal execution function provided.
169+
if (typeof this._actionCallback === 'function')
170+
{
171+
this._actionCallback(rosbridgeRequest.args, id);
172+
}
173173
}
174174

175175
/**

0 commit comments

Comments
 (0)