fix: Only set Android key if not null to prevent build errors

This commit is contained in:
oSumAtrIX 2024-01-27 04:02:33 +01:00
parent e362071505
commit 1181b0bca2
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -30,7 +30,7 @@ abstract class BasePreference(
*/
open fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit): Element =
ownerDocument.createElement(tag).apply {
setAttribute("android:key", key)
key?.let { setAttribute("android:key", it) }
setAttribute("android:title", "@string/${titleKey}")
summaryKey?.let { addSummary(it) }
}