File tree Expand file tree Collapse file tree 1 file changed +14
-16
lines changed
ReplayBrowser/Controllers Expand file tree Collapse file tree 1 file changed +14
-16
lines changed Original file line number Diff line number Diff line change @@ -119,29 +119,27 @@ [FromQuery] string guid
119
119
. Include ( a => a . History )
120
120
. FirstOrDefaultAsync ( a => a . Guid == parsedGuid ) ;
121
121
122
- if ( user == null )
123
- {
124
- return NotFound ( "Account is null. This should not happen." ) ;
125
- }
126
-
127
122
var zipStream = new MemoryStream ( ) ;
128
123
using ( var archive = new ZipArchive ( zipStream , ZipArchiveMode . Create , true ) )
129
124
{
130
- var historyEntry = archive . CreateEntry ( "history.json" ) ;
131
- using ( var entryStream = historyEntry . Open ( ) )
125
+ if ( user != null )
132
126
{
133
- await JsonSerializer . SerializeAsync ( entryStream , user . History ) ;
134
- }
127
+ var historyEntry = archive . CreateEntry ( "history.json" ) ;
128
+ using ( var entryStream = historyEntry . Open ( ) )
129
+ {
130
+ await JsonSerializer . SerializeAsync ( entryStream , user . History ) ;
131
+ }
135
132
136
- user . History = null ;
133
+ user . History = null ;
137
134
138
- var baseEntry = archive . CreateEntry ( "user.json" ) ;
139
- using ( var entryStream = baseEntry . Open ( ) )
140
- {
141
- await JsonSerializer . SerializeAsync ( entryStream , user , new JsonSerializerOptions
135
+ var baseEntry = archive . CreateEntry ( "user.json" ) ;
136
+ using ( var entryStream = baseEntry . Open ( ) )
142
137
{
143
- DefaultIgnoreCondition = JsonIgnoreCondition . WhenWritingNull
144
- } ) ;
138
+ await JsonSerializer . SerializeAsync ( entryStream , user , new JsonSerializerOptions
139
+ {
140
+ DefaultIgnoreCondition = JsonIgnoreCondition . WhenWritingNull
141
+ } ) ;
142
+ }
145
143
}
146
144
147
145
var replays = await _context . Replays
You can’t perform that action at this time.
0 commit comments