bitfireAT/ical4android

Ignore empty X-APPLE-CALENDAR-COLOR

Closed this issue · 4 comments

Hi,

using ICSx⁵ I got the following exception

length=0; index=0

java.lang.StringIndexOutOfBoundsException: length=0; index=0
	at java.lang.String.charAt(Native Method)
	at android.graphics.Color.parseColor(Color.java:1384)
	at at.bitfire.ical4android.Css3Color$Companion.colorFromString(Css3Color.kt:178)
	at at.bitfire.icsdroid.ui.AddCalendarValidationFragment$ValidationModel$initialize$downloader$1.onSuccess(AddCalendarValidationFragment.kt:126)
	at at.bitfire.icsdroid.CalendarFetcher.fetchNetwork$icsx5_62_2_0_2_standardRelease(CalendarFetcher.kt:155)
	at at.bitfire.icsdroid.CalendarFetcher.run(CalendarFetcher.kt:46)
	at java.lang.Thread.run(Thread.java:784)

which I think might come from the line X-APPLE-CALENDAR-COLOR: (value is empty) in my ics-file.

I suspect that Color.parseColor(…) not only throws IllegalArgumentException as caught in Css3Color line 189, but also StringIndexOutOfBoundsException for empty strings.

If necessary I will try to assemble a minimum working example.

Greetings Nmxcgeo

Thanks. Ignoring this invalid field sounds reasonable but I also think the original file should be fixed. Can you do that?

I will try, it's not directly under my control and I wasn't able to find out what i standard conformant.

Ah, I have just seen this issue. It should be fixed now with 819f468

The current release of DAVx⁵ has this included and accepts the problematic calendar. 🥳
Thanks everyone.