Skip to content

A fully functional Android app built entirely with Kotlin and Jetpack Compose

Add safe call to WorkInfo (again)

Don Turner5820b0e86c4e
diff --git a/sync/work/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/sync/workers/SyncWorkerTest.kt b/sync/work/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/sync/workers/SyncWorkerTest.kt
index b0d3e724f..481875e69 100644
--- a/sync/work/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/sync/workers/SyncWorkerTest.kt
+++ b/sync/work/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/sync/workers/SyncWorkerTest.kt
@@ -64,7 +64,7 @@ class SyncWorkerTest {
val preRunWorkInfo = workManager.getWorkInfoById(request.id).get()
// Assert
- assertEquals(WorkInfo.State.ENQUEUED, preRunWorkInfo.state)
+ assertEquals(WorkInfo.State.ENQUEUED, preRunWorkInfo?.state)
// Tells the testing framework that the constraints have been met
testDriver.setAllConstraintsMet(request.id)