Wrap lastReceiveddata in a try catch