Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes bug #350 #376

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fixes bug #350 #376

wants to merge 1 commit into from

Conversation

carrizo
Copy link

@carrizo carrizo commented Dec 15, 2017

This solves bug #350

I did reproduce the error described by @Rx2TF which throws this exception:
java.lang.ArrayIndexOutOfBoundsException: length=5; index=-1

Looks like EventRecurrence#parse() method is leaving some garbage data in the EventRecurrence#byday field. This can be reproduced calling parse() two times, one with a weekly recurrence and then with a monthly recurrence; after this, the byday field keeps some data from the first call.

I didn't solve the root problem in EventRecurrence class because it looks like I can easily break something there.

@@ -110,7 +110,9 @@ public static String getRepeatString(Context context, Resources r, EventRecurren
if(dayNumber == RecurrencePickerDialogFragment.LAST_NTH_DAY_OF_WEEK){
dayNumber = 5;
}
details = mMonthRepeatByDayOfWeekStrs[weekday][dayNumber - 1];
if (dayNumber > 0) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just prevents the exception - we would have a "monthly > on the same day every month" return a "monthly > on the {n}th {weekday} of the month" string.

@potatopeelings
Copy link

potatopeelings commented Dec 16, 2017

@carrizo - I believe a cleaner way to fix this would be to make recurrence.byday be null

I made the following changes to fix this issue. Give it a shot and let me know if you run into any issues.

  1. byday = null; to resetFields in EventRecurrence.java
    This takes care of updates via a parse.
  2. eventRecurrence.byday = null; to the end of the first if block in case RecurrenceModel.FREQ_MONTHLY: in copyModelToEventRecurrence in RecurrencePickerDialogFragment.java
    This takes care of updates via the UI.

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants