fix : crash si aucunes questions
continuous-integration/drone/push Build is passing Details

Multiplayer_Php
Yvan CALATAYUD 1 year ago
parent 1bcd519397
commit b4edd88cb4

@ -101,10 +101,12 @@ public partial class Questions
selectedQuestions.Add(questions[i]); selectedQuestions.Add(questions[i]);
} }
questions = selectedQuestions; questions = selectedQuestions;
if (!response.IsNullOrEmpty())
{
totalQuestion = response[0].total_questions; totalQuestion = response[0].total_questions;
} }
} }
}
private async Task Export() private async Task Export()
{ {
@ -126,9 +128,10 @@ public partial class Questions
{ {
await e.File.OpenReadStream().CopyToAsync(ms); await e.File.OpenReadStream().CopyToAsync(ms);
var bytes = ms.ToArray(); var bytes = ms.ToArray();
string s = Encoding.UTF8.GetString(bytes); string s = Encoding.Unicode.GetString(bytes);
s = s.Replace("\"", string.Empty); s = s.Replace("\"", string.Empty);
s = s.Replace("\0", string.Empty);
var rows = s.Split('\n'); var rows = s.Split('\n');
rows = rows.Skip(1).ToArray(); rows = rows.Skip(1).ToArray();

Loading…
Cancel
Save