diff --git a/src/can/can.cpp b/src/can/can.cpp index 5755a5cba7442762889487932483113a333972d2..e65a287fcb869313b0a2a05ca2ac436c8978cbbb 100755 --- a/src/can/can.cpp +++ b/src/can/can.cpp @@ -304,13 +304,15 @@ void CCAN::read_frame(unsigned int *can_id, unsigned char *data, int *len) frame=this->rx_frames.front(); this->rx_frames.pop(); *can_id=frame.can_id; - *len=frame.can_dlc; + *len=frame.can_dlc; //COMMENT: Do we need a cast ? frame.can_dlc is __u8 type variable (see /usr/include/linux/can.h) for(i=0;i<frame.can_dlc;i++) data[i]=frame.data[i]; } else { /* handle exceptions */ + this->can_access.exit(); + throw CCommException(_HERE_,"No data available",this->comm_id); } this->can_access.exit(); }