[Android] Catch null pointer exception

XilasZ xilasz at gmail.com
Thu May 16 19:44:06 CEST 2013


please don't do that, send alex's patches on the ML before commit/push, we
don't fix a simple NullPointerException with a try/catch.

a little quick digging reveals that getFilesDir() is faulty here.
getFilesDir() try to create folders in the internal memory (such as
/data/data/<pkg>/files), and return null if it can't (docs are wrong, see
http://code.google.com/p/android/issues/detail?id=8886).

here we are just trying to find the folder /data/data/<pkg>/, so we need to
find another way to find it, or just check context.getFilesDir(), but
please, no try/catch for a simple NullPointerException
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/private/android/attachments/20130516/7b039186/attachment.html>


More information about the Android mailing list