forrestguice / SuntimesCalendars

A calendar provider add-on for Suntimes.
GNU General Public License v3.0
32 stars 11 forks source link

App crash when clicking the "Open Calendar" button. #43

Closed YYYSSSHHH closed 3 years ago

YYYSSSHHH commented 3 years ago

Environment Info: APK Version: 0.5.4 (14) Android version: 6.0.1

Expected behavior: The app pop up a dialog, which prompts that ”The device lacks a calendar application“.

Repro Steps:

  1. The calendar application is not installed in the device.
  2. Click the “Navigation” button in the top right-hand corner of app.
  3. Click the “Open Calendar” button, then the app will crash. 33

The stack trace: FATAL EXCEPTION: main Process: com.forrestguice.suntimescalendars, PID: 2120 android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=content://com.android.calendar/time/1628498624827 flg=0x10000000 } at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1798) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1512) at android.app.Activity.startActivityForResult(Activity.java:3942) at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:50) at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:79) at android.app.Activity.startActivityForResult(Activity.java:3902) at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:859) at android.app.Activity.startActivity(Activity.java:4231) at android.app.Activity.startActivity(Activity.java:4199) at com.forrestguice.suntimeswidget.calendar.SuntimesCalendarActivity.onOptionsItemSelected(SuntimesCalendarActivity.java:494) at android.app.Activity.onMenuItemSelected(Activity.java:2926) at android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:408) at android.support.v7.app.AppCompatActivity.onMenuItemSelected(AppCompatActivity.java:195) at android.support.v7.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:113) at android.support.v7.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:113) at android.support.v7.app.ToolbarActionBar$2.onMenuItemClick(ToolbarActionBar.java:69) at android.support.v7.widget.Toolbar$1.onMenuItemClick(Toolbar.java:206) at android.support.v7.widget.ActionMenuView$MenuBuilderCallback.onMenuItemSelected(ActionMenuView.java:776) at android.support.v7.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:822) at android.support.v7.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:156) at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:969) at android.support.v7.view.menu.MenuPopup.onItemClick(MenuPopup.java:127) at android.widget.AdapterView.performItemClick(AdapterView.java:310) at android.widget.AbsListView.performItemClick(AbsListView.java:1145) at android.widget.AbsListView$PerformClick.run(AbsListView.java:3066) at android.widget.AbsListView$3.run(AbsListView.java:3903) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5539) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:745) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635) at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:107)

Do you confirm this bug? Thank you.

forrestguice commented 3 years ago

An exception is expected in this case, but the relevant block of code appears to be missing its try/catch.

Thanks for the report. This will be fixed in the next patch.