led: don’t crash on incorrect mode value

This commit is contained in:
Oleg Kalachev
2020-03-06 04:25:48 +03:00
parent 351b33cc5f
commit e9527b5efd

View File

@@ -263,7 +263,10 @@ void handleMavrosState(const mavros_msgs::State& msg)
// remove the part before "."
mode = mode.substr(mode.find(".") + 1);
}
notify(mode);
std::string err;
if (ros::names::validate(mode, err)) {
notify(mode);
}
}
mavros_state = msg;
}