Skip to content

Commit 819f919

Browse files
Update Sources/PowerSync/Kotlin/KotlinPowerSyncDatabaseImpl.swift
Co-authored-by: Copilot <[email protected]>
1 parent 2153b22 commit 819f919

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Sources/PowerSync/Kotlin/KotlinPowerSyncDatabaseImpl.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,11 +379,15 @@ final class KotlinPowerSyncDatabaseImpl: PowerSyncDatabaseProtocol {
379379

380380
do {
381381
let pagesData = try encoder.encode(rootPages)
382+
guard let pagesString = String(data: pagesData, encoding: .utf8) else {
383+
throw PowerSyncError.operationFailed(
384+
message: "Failed to convert pages data to UTF-8 string"
385+
)
386+
}
382387
let tableRows = try await getAll(
383388
sql: "SELECT tbl_name FROM sqlite_master WHERE rootpage IN (SELECT json_each.value FROM json_each(?))",
384389
parameters: [
385-
String(data: pagesData, encoding: .utf8)
386-
]
390+
pagesString
387391
) { try $0.getString(index: 0) }
388392

389393
return Set(tableRows)

0 commit comments

Comments
 (0)