Skip to content

Commit 6fc5622

Browse files
committed
Merge branch 'master' of https://github.com/Bunny83/SimpleJSON into master
2 parents e2f5aa4 + 7a35246 commit 6fc5622

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

SimpleJSON.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ public virtual JSONObject AsObject
363363

364364
public static implicit operator JSONNode(string s)
365365
{
366-
return new JSONString(s);
366+
return (s is null) ? (JSONNode) JSONNull.CreateOrGet() : new JSONString(s);
367367
}
368368
public static implicit operator string(JSONNode d)
369369
{

SimpleJSONUnity.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public Color ReadColor(Color aDefault)
263263
if (IsObject)
264264
return new Color(this["r"].AsFloat, this["g"].AsFloat, this["b"].AsFloat, HasKey("a")?this["a"].AsFloat:ColorDefaultAlpha);
265265
if (IsArray)
266-
return new Color(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat, (Count>4)?this[3].AsFloat:ColorDefaultAlpha);
266+
return new Color(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat, (Count>3)?this[3].AsFloat:ColorDefaultAlpha);
267267
return aDefault;
268268
}
269269
public Color ReadColor()
@@ -296,7 +296,7 @@ public Color32 ReadColor32(Color32 aDefault)
296296
if (IsObject)
297297
return new Color32((byte)this["r"].AsInt, (byte)this["g"].AsInt, (byte)this["b"].AsInt, (byte)(HasKey("a")?this["a"].AsInt:Color32DefaultAlpha));
298298
if (IsArray)
299-
return new Color32((byte)this[0].AsInt, (byte)this[1].AsInt, (byte)this[2].AsInt, (byte)((Count>4)?this[3].AsInt:Color32DefaultAlpha));
299+
return new Color32((byte)this[0].AsInt, (byte)this[1].AsInt, (byte)this[2].AsInt, (byte)((Count>3)?this[3].AsInt:Color32DefaultAlpha));
300300
return aDefault;
301301
}
302302
public Color32 ReadColor32()

0 commit comments

Comments
 (0)