David created CB-4632: ------------------------- Summary: NPE exception when getting image from gallery. Key: CB-4632 URL: https://issues.apache.org/jira/browse/CB-4632 Project: Apache Cordova Issue Type: Bug Components: Plugin Camera Affects Versions: 2.7.0 Environment: Android Reporter: David Assignee: Steve Gill
When selecting a picture from gallery app crashes with a NPE: java.lang.RuntimeException: Unable to resume activity {com.xmile.events/com.xmile.events.MainActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=18, result=-1, data=Intent { dat=content://media/external/images/media/8908 (has extras) }} to activity {com.xmile.events/com.xmile.events.MainActivity}: java.lang.NullPointerException at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2616) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2644) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2130) at android.app.ActivityThread.access$600(ActivityThread.java:140) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4898) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=18, result=-1, data=Intent { dat=content://media/external/images/media/8908 (has extras) }} to activity {com.xmile.events/com.xmile.events.MainActivity}: java.lang.NullPointerException at android.app.ActivityThread.deliverResults(ActivityThread.java:3182) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2603) ... 12 more Caused by: java.lang.NullPointerException at org.apache.cordova.DroidGap.onActivityResult(DroidGap.java:858) at android.app.Activity.dispatchActivityResult(Activity.java:5390) at android.app.ActivityThread.deliverResults(ActivityThread.java:3178) ... 13 more The javascript code is: /** * Select picture from library */ function selectPicture() { pictureSource=navigator.camera.PictureSourceType; destinationType=navigator.camera.DestinationType; // Retrieve image file location from specified source navigator.camera.getPicture( onPhotoURISuccess, onFail, { quality: 100, destinationType: destinationType.FILE_URI, sourceType: pictureSource.PHOTOLIBRARY }); } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira