Skip to content

Commit ccb8642

Browse files
author
Brian MacIntosh
committed
JSON masquerading as YAML will not cause a crash
1 parent c4e914f commit ccb8642

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

UnityProjectBrowser/Parsers/UnityAssetParser.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ public override void ParseFile(string absolutePath)
4949
foreach (YamlDocument document in stream.Documents)
5050
{
5151
YamlMappingNode documentNode = (YamlMappingNode)document.RootNode;
52+
if (documentNode.Anchor == null)
53+
{
54+
// might be a JSON file (XRSettings.asset), skip for now
55+
continue;
56+
}
57+
5258
long fileId = long.Parse(documentNode.Anchor);
5359
UnityObjectKey key = new UnityObjectKey(guid, fileId);
5460
KeyValuePair<YamlNode, YamlNode> rootNode = documentNode.Children.First();

0 commit comments

Comments
 (0)