Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-28193

Android: Selecting multiple photos/videos via openPhotoGallery() can cause a crash as of 9.1.0

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Release 9.1.0
    • Fix Version/s: Release 9.3.0, Release 9.2.2
    • Component/s: Android
    • Environment:
    • Story Points:
      3

      Description

      This is a regression. Broken since 9.1.0.GA.

      Issue is seen only when multiple photos are selected. Selecting multiple photos from google photos does not cause this issue.

      Steps to reproduce:

      1. Use the code below in the app.js:

          layout: 'vertical',
          backgroundColor: 'gray'
      });
       
      galleryBtn = Ti.UI.createButton({
          title: 'Open Gallery'
      });
       
      galleryBtn.addEventListener('click', () => {
      	Ti.Media.openPhotoGallery({
      		allowMultiple: true,
      		error: function(e){
      			Ti.API.error(e);
      		},
      		success: function(e){
      			Ti.API.info(e);
      		}
      	});
      });
       
      win.add([galleryBtn]);
       
      win.open();
      

      2. After the app launches click open gallery.
      3. Select multiple photos from the gallery & click open/select.

      Actual result:

      1. The app crashes with error:

      [ERROR] :  TiExceptionHandler: (main) [4,18345] Failure delivering result ResultInfo{who=null, request=2, result=-1, data=Intent { flg=0x1 clip={image/* U:content://com.android.providers.media.documents/document/image%3A25876 ...} }} to activity {com.app.zzzz/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.toString()' on a null object reference
      [ERROR] :  TiExceptionHandler:
      [ERROR] :  TiExceptionHandler:     ti.modules.titanium.media.MediaModule$1.onResult(MediaModule.java:973)
      [ERROR] :  TiExceptionHandler:     org.appcelerator.titanium.util.TiActivitySupportHelper$1.onResult(TiActivitySupportHelper.java:60)
      [ERROR] :  TiExceptionHandler:     org.appcelerator.titanium.util.TiActivitySupportHelper.onActivityResult(TiActivitySupportHelper.java:117)
      [ERROR] :  TiExceptionHandler:     org.appcelerator.titanium.TiBaseActivity.onActivityResult(TiBaseActivity.java:900)
      [ERROR] :  TiExceptionHandler:     android.app.Activity.dispatchActivityResult(Activity.java:7759)
      [ERROR] :  TiExceptionHandler:     android.app.ActivityThread.deliverResults(ActivityThread.java:4626)
      [ERROR] :  TiExceptionHandler:     android.app.ActivityThread.handleSendResult(ActivityThread.java:4675)
      [ERROR] :  TiExceptionHandler:     android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
      [ERROR] :  TiExceptionHandler:     android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
      [ERROR] :  TiExceptionHandler:     android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
      [ERROR] :  TiExceptionHandler:     android.app.ActivityThread$H.handleMessage(ActivityThread.java:1950)
      [ERROR] :  TiExceptionHandler:     android.os.Handler.dispatchMessage(Handler.java:106)
      [ERROR] :  TiExceptionHandler:     android.os.Looper.loop(Looper.java:214)
      [ERROR] :  TiExceptionHandler:     android.app.ActivityThread.main(ActivityThread.java:7073)
      [ERROR] :  TiExceptionHandler:     java.lang.reflect.Method.invoke(Native Method)
      [ERROR] :  TiExceptionHandler:     com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
      [ERROR] :  TiExceptionHandler:     com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
      

      Expected result:

      1. The app should not crash.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jquick Joshua Quick
                Reporter:
                lchoudhary Lokesh Choudhary
                Reviewer:
                Gary Mathews
                Tester:
                Samir Mohammed
              • Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration