Skip to content

Commit 17b9784

Browse files
author
Jack Brookes
committed
null check fixes
1 parent 2501dc3 commit 17b9784

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Assets/UXF/Scripts/FileIOManager.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,9 @@ public void WriteTrials(List<ResultsDictionary> dictList, WriteFileInfo writeFil
213213
// hashset keeps unique set of keys
214214
HashSet<string> headers = new HashSet<string>();
215215
foreach (ResultsDictionary dict in dictList)
216-
{
217216
if (dict != null)
218-
{
219217
foreach (string key in dict.Keys)
220218
headers.Add(key);
221-
}
222-
}
223219

224220
// final output: array of rows (comma-separated strings)
225221
string[] csvRows = new string[dictList.Count + 1];
@@ -230,6 +226,7 @@ public void WriteTrials(List<ResultsDictionary> dictList, WriteFileInfo writeFil
230226
for (int i = 0; i < dictList.Count; i++)
231227
{
232228
ResultsDictionary dict = dictList[i];
229+
if (dict == null) continue; // empty trial, try next loop iteration
233230

234231
// add all observations to the row, in correct order.
235232
// check if null, if so assign to empty string (?? operator)

0 commit comments

Comments
 (0)