Skip to content

Commit 8bb9747

Browse files
Skip calAddress for attendees and organizers without a valid URI (#332)
Co-authored-by: Ricki Hirner <hirner@bitfire.at>
1 parent d59e9c6 commit 8bb9747

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

lib/src/main/kotlin/at/bitfire/ical4android/JtxICalObject.kt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,12 @@ open class JtxICalObject(
831831
attendees.forEach { attendee ->
832832
val attendeeProp = net.fortuna.ical4j.model.property.Attendee().apply {
833833
if(attendee.caladdress?.isNotEmpty() == true)
834-
this.calAddress = URI(attendee.caladdress)
834+
this.calAddress = try {
835+
URI(attendee.caladdress)
836+
} catch (_: Exception) {
837+
logger.warning("Ignoring invalid attendee URI: ${attendee.caladdress}")
838+
return@forEach
839+
}
835840

836841
attendee.cn?.let {
837842
this += Cn(it)
@@ -884,7 +889,11 @@ open class JtxICalObject(
884889
organizer?.let { organizer ->
885890
val organizerProp = net.fortuna.ical4j.model.property.Organizer().apply {
886891
if(organizer.caladdress?.isNotEmpty() == true)
887-
calAddress = URI(organizer.caladdress)
892+
try {
893+
this.calAddress = URI(organizer.caladdress)
894+
} catch (_: Exception) {
895+
logger.warning("Ignoring invalid organizer URI: ${organizer.caladdress}")
896+
}
888897

889898
organizer.cn?.let {
890899
add<Property>(Cn(it))

0 commit comments

Comments
 (0)