phonegap / phonegap-plugin-contentsync

Download and cache remotely hosted content
Apache License 2.0
206 stars 98 forks source link

Avoid crash (NullPointerException) on Android if dir.list() return null #153

Closed ghost closed 7 years ago

ghost commented 7 years ago

"dir.list().length", in the Log.d, at line 520 may cause "NullPointerException" as the list method returns either an array of string or null.

DOC: https://developer.android.com/reference/java/io/File.html#list()

LOGS : FATAL EXCEPTION: pool-1-thread-2 Process: com.fullspark.nhhp, PID: 2746 java.lang.NullPointerException: Attempt to get length of null array at com.adobe.phonegap.contentsync.Sync$4.run(Sync.java:520) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecuto at java.lang.Thread.run(Thread.java:818)

macdonst commented 7 years ago

@rosatof thank you 🙏