Skip to content

Commit

Permalink
[google_chat_ros] check whether google_chat_button's parameters inclu…
Browse files Browse the repository at this point in the history
…de NoneType object for avoiding rospy serialization error
  • Loading branch information
mqcmd196 committed Dec 17, 2023
1 parent 4b9a091 commit b860db8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions google_chat_ros/scripts/google_chat_ros_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,11 @@ def event_cb(self, event, publish_topic=True):
action = event.get('action')
msg.action.action_method_name = action.get('actionMethodName')
if action.get('parameters'):
parameters = []
for param in action.get('parameters'):
action_parameter = ActionParameter()
action_parameter.key = param.get('key')
action_parameter.value = param.get('value')
parameters.append(action_parameter)
msg.action.parameters = parameters
action_parameter.key = param.get("key") if param.get("key") else ""
action_parameter.value = param.get("value") if param.get("value") else ""
msg.action.parameters.append(action_parameter)
if publish_topic:
self._card_activity_pub.publish(msg)
return msg
Expand Down
2 changes: 1 addition & 1 deletion google_chat_ros/src/google_chat_ros/google_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def _pubsub_cb(self, message):
except Exception as e:
rospy.logerr("Failed to handle the request from Cloud PubSub.")
rospy.logerr("It might be caused because of invalid type message from GCP")
rospy.logerr("{}".str(e))
rospy.logerr(e)
finally:
message.ack()

Expand Down

0 comments on commit b860db8

Please sign in to comment.