Added error catch.

Added an error catch in case local storage breaks.