AppWerft / Ti.FilePicker

Titanium module for retreiving files from file system
Other
5 stars 7 forks source link

NullPointerException on exit the explorer without select a file (using back button) #1

Open aalvlopez opened 8 years ago

aalvlopez commented 8 years ago

When the file explorer is opened and instead of select a file, press the back button to cancel the action, the application crashes with this error:

[ERROR] AndroidRuntime: FATAL EXCEPTION: main [ERROR] AndroidRuntime: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=42, result=0, data=null} to activity {com.app/org.appcelerator.titanium.T iActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.net.Uri android.content.Intent.getData()' on a null object reference [ERROR] AndroidRuntime: at android.app.ActivityThread.deliverResults(ActivityThread.java:4005) [ERROR] AndroidRuntime: at android.app.ActivityThread.handleSendResult(ActivityThread.java:4048) [ERROR] AndroidRuntime: at android.app.ActivityThread.access$1400(ActivityThread.java:177) [ERROR] AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1479) [ERROR] AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102) [ERROR] AndroidRuntime: at android.os.Looper.loop(Looper.java:135)

[ERROR] AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5910) [ERROR] AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) [ERROR] AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:372) [ERROR] AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405) [ERROR] AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200) [ERROR] AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.net.Uri android.content.Intent.getData()' on a null object reference [ERROR] AndroidRuntime: at ti.filepicker.TifilepickerModule$1.onResult(TifilepickerModule.java:125) [ERROR] AndroidRuntime: at org.appcelerator.titanium.util.TiActivitySupportHelper$1.onResult(TiActivitySupportHelper.java:58) [ERROR] AndroidRuntime: at org.appcelerator.titanium.util.TiActivitySupportHelper.onActivityResult(TiActivitySupportHelper.java:107) [ERROR] AndroidRuntime: at org.appcelerator.titanium.TiBaseActivity.onActivityResult(TiBaseActivity.java:829) [ERROR] AndroidRuntime: at android.app.Activity.dispatchActivityResult(Activity.java:6441) [ERROR] AndroidRuntime: at android.app.ActivityThread.deliverResults(ActivityThread.java:4001) [ERROR] AndroidRuntime: ... 10 more

My javaScript code is:

var FilePicker = require("ti.filepicker");
FilePicker.getFileSelectDialog({
            mimeTypes: ["*/*"],
            resultType: FilePicker.TYPE_FILE,
            destinationStorage: FilePicker.TEMP_STORAGE, // or EXTERNAL_STORAGE
            onSuccess: function(_e) {
                var resultFile = _e.file;
                console.log(resultFile.resolve());
            }
        });
AppWerft commented 8 years ago

OK, I will fix in next time. Edit: patched => new version