Guard all localStorage calls with try/catch