Move SSD PDF scan text checks to typed Kotlin

ober

772a9a2db15f033aae3e17ab156f84121dff67f6

diff --git a/templates/ssd-review.ss b/templates/ssd-review.ss
index ee0316f..ab1b5d3 100644
--- a/templates/ssd-review.ss
+++ b/templates/ssd-review.ss
@@ -7386,10 +7386,12 @@
        "            val nameCol = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DISPLAY_NAME)"
        "            val pathCol = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.RELATIVE_PATH)"
        "            while (cursor.moveToNext()) {"
-       "                val name = cursor.getString(nameCol) ?: continue"
+       "                val rawName = cursor.getString(nameCol)"
+       "                if (!nullableTextPresent(rawName)) continue"
+       "                val name = nullableTextOrEmpty(rawName)"
        "                if (shouldSkipSsdPdfChoiceName(name, choices.size, MAX_SSD_PDF_CHOICES)) continue"
        "                val id = cursor.getLong(idCol)"
-       "                val relativePath = cursor.getString(pathCol)?.trim('/') ?: \"\""
+       "                val relativePath = nullableTextOrEmpty(cursor.getString(pathCol)).trim('/')"
        "                val label = ssdPdfDownloadLabel(relativePath, name)"
        "                choices.add(SsdPdfChoice(label, ContentUris.withAppendedId(MediaStore.Downloads.EXTERNAL_CONTENT_URI, id)))"
        "            }"
@@ -7432,7 +7434,9 @@
        "            .sortedWith(compareBy<DocumentFile>({ ssdPdfDocumentNotDirectory(it) }, { nullableLowercaseOrEmpty(it.name) }))"
        "            .forEach { child ->"
        "                if (shouldStopSsdPdfTreeScan(depth, choices.size, MAX_SSD_PDF_CHOICES, MAX_SSD_PDF_SCAN_DEPTH)) return"
-       "                val name = child.name ?: return@forEach"
+       "                val rawName = child.name"
+       "                if (!nullableTextPresent(rawName)) return@forEach"
+       "                val name = nullableTextOrEmpty(rawName)"
        "                val label = ssdPdfTreeLabel(prefix, name)"
        "                if (ssdPdfDocumentIsDirectory(child)) {"
        "                    collectSsdPdfs(child, label, choices, depth + 1)"