Skip to content

Commit be2b19d

Browse files
committed
Explicit null check / KDoc
1 parent a937e5d commit be2b19d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class AndroidEvent(
143143

144144

145145
/**
146-
* Saves an unsaved event into the calendar storage.
146+
* Saves the unsaved [event] into the calendar storage.
147147
*
148148
* @return content URI of the created event
149149
*
@@ -153,8 +153,9 @@ class AndroidEvent(
153153
fun add(): Uri {
154154
val batch = CalendarBatchOperation(calendar.client)
155155

156-
val builder = AndroidEventBuilder(calendar, event!!, id, syncId, eTag, scheduleTag, flags)
157-
val idxEvent = builder.addOrUpdateRows(event!!, batch) ?: throw AssertionError("Expected Events._ID backref")
156+
val requiredEvent = requireNotNull(event)
157+
val builder = AndroidEventBuilder(calendar, requiredEvent, id, syncId, eTag, scheduleTag, flags)
158+
val idxEvent = builder.addOrUpdateRows(requiredEvent, batch) ?: throw AssertionError("Expected Events._ID backref")
158159
batch.commit()
159160

160161
val resultUri = batch.getResult(idxEvent)?.uri

0 commit comments

Comments
 (0)