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

Android: Canceling out of Ti.Media.openPhotoGallery() causes a crash as of 9.1.0

    Details

    • Story Points:
      1
    • Sprint:
      2020 Sprint 20

      Description

      Summary:
      As of Titanium 9.1.0, calling Ti.Media.openPhotoGallery() and then backing-out of the gallery apps without making a selection will cause a crash on Android. This issue does not happen if you select a photo. It only happens when you cancel out.

      Steps to reproduce:

      1. Build and run PhotoVideoSelectTest.js on Android with Titanium 9.1.0 or higher.
      2. When the alert dialog appears, select "Photo".
      3. Back out of the photo gallery app. (Do NOT select a photo.)
      4. Notice the app crashes.

      java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=0, data=null} to activity {com.comehome/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.net.Uri android.content.Intent.getData()' on a null object reference
              at android.app.ActivityThread.deliverResults(ActivityThread.java:4496)
              at android.app.ActivityThread.handleSendResult(ActivityThread.java:4538)
              at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
              at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
              at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1906)
              at android.os.Handler.dispatchMessage(Handler.java:106)
              at android.os.Looper.loop(Looper.java:193)
              at android.app.ActivityThread.main(ActivityThread.java:6863)
              at java.lang.reflect.Method.invoke(Method.java:-2)
              at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
       
      Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.net.Uri android.content.Intent.getData()' on a null object reference
              at ti.modules.titanium.media.MediaModule$1.onResult(MediaModule.java:970)
              at org.appcelerator.titanium.util.TiActivitySupportHelper$1.onResult(TiActivitySupportHelper.java:60)
              at org.appcelerator.titanium.util.TiActivitySupportHelper.onActivityResult(TiActivitySupportHelper.java:117)
              at org.appcelerator.titanium.TiBaseActivity.onActivityResult(TiBaseActivity.java:900)
              at android.app.Activity.dispatchActivityResult(Activity.java:7476)
              at android.app.ActivityThread.deliverResults(ActivityThread.java:4489)
              at android.app.ActivityThread.handleSendResult(ActivityThread.java:4538)
              at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
              at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
              at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1906)
              at android.os.Handler.dispatchMessage(Handler.java:106)
              at android.os.Looper.loop(Looper.java:193)
              at android.app.ActivityThread.main(ActivityThread.java:6863)
              at java.lang.reflect.Method.invoke(Method.java:-2)
              at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
      

      Note:
      Andrea Vitale has an end-user that has this issue on a OnePlus A3003. The end-user claims that an image is being selected, although this crash should only happen if you cancel out of the gallery. Either way, the line of code that it's crashing on indicates no selection was made.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jquick Joshua Quick
                Reporter:
                Andrea.Vitale Andrea Vitale
                Reviewer:
                Gary Mathews
                Tester:
                Satyam Sekhri
              • Watchers:
                5 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