@@ -63,7 +63,14 @@ await FilesystemTasks.Wrap(() => StorageFile.GetFileFromPathAsync(Path.Combine(a
6363 path = path . Substring ( @"\\?\" . Length ) ;
6464 }
6565
66- var folder = await StorageFolder . GetFolderFromPathAsync ( path ) ;
66+ var folderResult = await FilesystemTasks . Wrap ( ( ) => StorageFolder . GetFolderFromPathAsync ( path ) . AsTask ( ) ) ;
67+ if ( ! folderResult )
68+ {
69+ _logger . LogWarning ( $ "Could not access Google Drive path as local storage: { path } ") ;
70+ continue ;
71+ }
72+
73+ var folder = folderResult . Result ;
6774 string title = reader [ "title" ] ? . ToString ( ) ?? folder . Name ;
6875
6976 Debug . WriteLine ( "YIELD RETURNING from `GoogleDriveCloudDetector.GetProviders()` (roots): " ) ;
@@ -89,7 +96,14 @@ await FilesystemTasks.Wrap(() => StorageFile.GetFileFromPathAsync(Path.Combine(a
8996 if ( ! AddMyDriveToPathAndValidate ( ref path ) )
9097 continue ;
9198
92- var folder = await StorageFolder . GetFolderFromPathAsync ( path ) ;
99+ var folderResult = await FilesystemTasks . Wrap ( ( ) => StorageFolder . GetFolderFromPathAsync ( path ) . AsTask ( ) ) ;
100+ if ( ! folderResult )
101+ {
102+ _logger . LogWarning ( $ "Could not access Google Drive path as local storage: { path } ") ;
103+ continue ;
104+ }
105+
106+ var folder = folderResult . Result ;
93107 string title = reader [ "name" ] ? . ToString ( ) ?? folder . Name ;
94108
95109 Debug . WriteLine ( "YIELD RETURNING from `GoogleDriveCloudDetector.GetProviders` (media): " ) ;
@@ -269,7 +283,8 @@ private static bool ValidatePath(string path)
269283
270284 var iconPath = Path . Combine ( programFilesEnvVar , "Google" , "Drive File Stream" , "drive_fs.ico" ) ;
271285
272- return await FilesystemTasks . Wrap ( ( ) => StorageFile . GetFileFromPathAsync ( iconPath ) . AsTask ( ) ) ;
286+ var iconFileResult = await FilesystemTasks . Wrap ( ( ) => StorageFile . GetFileFromPathAsync ( iconPath ) . AsTask ( ) ) ;
287+ return iconFileResult ? iconFileResult . Result : null ;
273288 }
274289
275290 private static bool AddMyDriveToPathAndValidate ( ref string path )
0 commit comments