Merge pull request #340 from hiroj/handling_stackOverflowException

handling stackOverflowException
This commit is contained in:
ousttrue 2019-12-13 15:13:48 +09:00 committed by GitHub
commit 230f842874
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -255,9 +255,20 @@ namespace UniGLTF
throw new Exception("chunk 1 is not BIN");
}
var jsonBytes = chunks[0].Bytes;
ParseJson(Encoding.UTF8.GetString(jsonBytes.Array, jsonBytes.Offset, jsonBytes.Count),
new SimpleStorage(chunks[1].Bytes));
try
{
var jsonBytes = chunks[0].Bytes;
ParseJson(Encoding.UTF8.GetString(jsonBytes.Array, jsonBytes.Offset, jsonBytes.Count),
new SimpleStorage(chunks[1].Bytes));
}
catch(StackOverflowException ex)
{
throw new Exception("[UniVRM Import Error] json parsing failed, nesting is too deep.\n" + ex);
}
catch
{
throw;
}
}
public bool UseUniJSONParser;