Rewrite loop that stopped working in Kotlin 2.1.21

This commit is contained in:
Sylvia van Os
2025-06-02 23:11:43 +02:00
parent 79795ff328
commit 4cb601e0ce

View File

@@ -67,8 +67,17 @@ class PkpassParser(context: Context, uri: Uri?) {
try {
mContext.contentResolver.openInputStream(uri).use { inputStream ->
ZipInputStream(inputStream).use { zipInputStream ->
var localFileHeader: LocalFileHeader
while ((zipInputStream.nextEntry.also { localFileHeader = it }) != null) {
var localFileHeader: LocalFileHeader?
while (true) {
// Retrieve the next file
localFileHeader = zipInputStream.nextEntry
// If no next file, exit loop
if (localFileHeader == null) {
break
}
// Ignore directories
if (localFileHeader.isDirectory) continue