Make SSD truth index cache non-null

ober

a8869a0e35c53dfb6e50286c35cbbf07323582dc

diff --git a/templates/ssd-review.ss b/templates/ssd-review.ss
index 3215f83..784f944 100644
--- a/templates/ssd-review.ss
+++ b/templates/ssd-review.ss
@@ -8710,7 +8710,8 @@
        "    private val reviewsDir = File(root, \"reviews\")"
        "    private val remoteConfig: RemoteConfig? by lazy { loadRemoteConfig() }"
        "    @Volatile private var seedStarted = false"
-       "    @Volatile private var truthIndexCache: List<TruthIndexEntry>? = null"
+       "    @Volatile private var truthIndexCacheLoaded = false"
+       "    @Volatile private var truthIndexCache: List<TruthIndexEntry> = emptyList()"
        ""
        "    init {"
        "        listOf(root, groundTruthDir, learnedDir, eventsDir, reviewsDir).forEach { it.mkdirs() }"
@@ -8741,12 +8742,13 @@
        ""
        "    @Synchronized"
        "    private fun invalidateTruthIndex() {"
-       "        truthIndexCache = null"
+       "        truthIndexCacheLoaded = false"
+       "        truthIndexCache = emptyList()"
        "    }"
        ""
        "    @Synchronized"
        "    private fun truthIndexEntries(): List<TruthIndexEntry> {"
-       "        if (nullableAnyPresent(truthIndexCache)) return checkNotNull(truthIndexCache)"
+       "        if (truthIndexCacheLoaded) return truthIndexCache"
        "        val entries = if (fileListFilesPresent(groundTruthDir)) {"
        "            checkNotNull(groundTruthDir.listFiles { f -> truthJsonFileName(f.name) })"
        "                .sortedBy { it.name }"
@@ -8755,6 +8757,7 @@
        "            emptyList()"
        "        }"
        "        truthIndexCache = entries"
+       "        truthIndexCacheLoaded = true"
        "        return entries"
        "    }"
        ""