Skip to content

Commit

Permalink
check settings pointer and print error if null
Browse files Browse the repository at this point in the history
  • Loading branch information
mathias-luedtke committed Sep 22, 2020
1 parent db242bf commit c0be7eb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions socketcan_interface/include/socketcan_interface/socketcan.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ class SocketCANInterface : public AsioDriver<boost::asio::posix::stream_descript
return init(device, loopback, NoSettings::create());
}
virtual bool init(const std::string &device, bool loopback, SettingsConstSharedPtr settings) override {
if (!settings) {
ROSCANOPEN_ERROR("socketcan_interface", "settings must not be a null pointer");
return false;
}
const can_err_mask_t fatal_errors = ( CAN_ERR_TX_TIMEOUT /* TX timeout (by netdevice driver) */
| CAN_ERR_BUSOFF /* bus off */
| CAN_ERR_BUSERROR /* bus error (may flood!) */
Expand Down

0 comments on commit c0be7eb

Please sign in to comment.