Skip to content

Commit

Permalink
Fix possible nullref
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzalop committed Mar 22, 2012
1 parent 53aaa8c commit 2bd2130
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mcs/class/System.Json/System.Json/JsonArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,12 @@ public override void Save (Stream stream)
throw new ArgumentNullException ("stream");
stream.WriteByte ((byte) '[');
for (int i = 0; i < list.Count; i++) {
list [i].Save (stream);
JsonValue v = list [i];
if (v != null)
v.Save (stream);
else
w.Write ("null");

if (i < Count - 1) {
stream.WriteByte ((byte) ',');
stream.WriteByte ((byte) ' ');
Expand Down

0 comments on commit 2bd2130

Please sign in to comment.