01/04/2011 § 10 Comments
I recently had a problem where a web app that worked fine on the iPhone, iPhone Simulator, Safari Mac, Safari Windows, Chrome and the Android Emulator would not work at all on any Android device. After tracking down someone who had an Android phone and was able to debug the app, we discovered:
Console: Uncaught illegal access
in the debugging output that was eventually traced back to a JSON.parse() call that had a null parameter. On all other platforms this returns null, on the Android device it throws an exception. See this bug report for details.
Moral of the story? Always explicitly check your parameter to JSON.parse() for null… and don’t trust the emulator!