Skip to content

Commit 5277c2d

Browse files
committed
Fix IUO issue in NSFileManager.swift for Linux build.
1 parent 4331805 commit 5277c2d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Foundation/NSFileManager.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,10 @@ public class NSFileManager : NSObject {
246246
}
247247

248248
defer {
249-
closedir(dir)
249+
closedir(dir!)
250250
}
251251

252-
while let entry = readdir(dir) {
252+
while let entry = readdir(dir!) {
253253
if let entryName = withUnsafePointer(&entry.pointee.d_name, { (ptr) -> String? in
254254
return String(cString: UnsafePointer<Int8>(ptr))
255255
}) {
@@ -286,10 +286,10 @@ public class NSFileManager : NSObject {
286286
}
287287

288288
defer {
289-
closedir(dir)
289+
closedir(dir!)
290290
}
291291

292-
var entry = readdir(dir)
292+
var entry = readdir(dir!)
293293

294294
while entry != nil {
295295
if let entryName = withUnsafePointer(&entry!.pointee.d_name, { (ptr) -> String? in

0 commit comments

Comments
 (0)