File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -692,6 +692,12 @@ private struct UNIXPath: Path {
692
692
693
693
init ( validatingAbsolutePath path: String ) throws {
694
694
#if os(Windows)
695
+ // Explicitly handle the empty path, since retrieving
696
+ // `fileSystemRepresentation` of it is illegal.
697
+ guard !path. isEmpty else {
698
+ throw PathValidationError . invalidAbsolutePath ( path)
699
+ }
700
+
695
701
let fsr : UnsafePointer < Int8 > = path. fileSystemRepresentation
696
702
defer { fsr. deallocate ( ) }
697
703
@@ -714,6 +720,12 @@ private struct UNIXPath: Path {
714
720
715
721
init ( validatingRelativePath path: String ) throws {
716
722
#if os(Windows)
723
+ // Explicitly handle the empty path, since retrieving
724
+ // `fileSystemRepresentation` of it is illegal.
725
+ guard !path. isEmpty else {
726
+ throw PathValidationError . invalidRelativePath ( path)
727
+ }
728
+
717
729
let fsr : UnsafePointer < Int8 > = path. fileSystemRepresentation
718
730
defer { fsr. deallocate ( ) }
719
731
You can’t perform that action at this time.
0 commit comments