File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
LocalNetAppChat.Domain/Clientside/ServerApis Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -76,8 +76,19 @@ public async Task SendFile(string filePath)
7676 public async Task < string [ ] > GetServerFiles ( )
7777 {
7878 var result = await _apiAccessor . GetAsync ( "listallfiles" ) ;
79- var receivedFilesList = JsonSerializer . Deserialize < string [ ] > ( result ) ;
80- return receivedFilesList ?? Array . Empty < string > ( ) ;
79+
80+ try
81+ {
82+ var receivedFilesList = JsonSerializer . Deserialize < string [ ] > ( result ) ;
83+ return receivedFilesList ?? Array . Empty < string > ( ) ;
84+ }
85+ catch ( Exception ex )
86+ {
87+ Console . WriteLine ( $ "Received { result } , which is not valid JSON") ;
88+ Console . WriteLine ( ex . Message ) ;
89+ }
90+
91+ return Array . Empty < string > ( ) ;
8192 }
8293
8394 public async Task DownloadFile ( string filename , string targetPath )
Original file line number Diff line number Diff line change 2323}
2424
2525var serverKey = parser . TryGetOptionWithValue < string > ( "--key" ) ;
26- var accessControl = new KeyBasedAccessControl ( serverKey ) ;
26+ var accessControl = new KeyBasedAccessControl ( serverKey ?? string . Empty ) ;
2727
2828var messagingServiceProvider = new MessagingServiceProvider (
2929 accessControl ,
You can’t perform that action at this time.
0 commit comments