You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I haven't figured out why some paths in my story are throwing this exception and not others, but as far as I can tell there's nothing wrong with the knots it's failing on. The exception I'm seeing is:
NullReferenceException: Object reference not set to an instance of an object
Ink.Runtime.Story.TagsAtStartOfFlowContainerWithPathString (System.String pathString) (at Assets/Plugins/Ink/InkRuntime/Story.cs:1581)
Ink.Runtime.Story.TagsForContentAtPath (System.String path) (at Assets/Plugins/Ink/InkRuntime/Story.cs:1566)
It seems like in some of my knots, the first element in flowContainer.Content is not a compiled weave as the comment says it should be, but a tag. innerWeaveContainer is then null, which throws the exception on Story.cs:1581 when we try to fetch its content.
I found a workaround , which thusfar has fetched all my tags perfectly, but I'm not sure if this is a viable fix or if I'm just covering up for something wrong with my story structure:
var innerWeaveContainer = flowContainer.content [0] as Container;
// My workaround is below.
if (innerWeaveContainer == null) {
innerWeaveContainer = flowContainer;
}
If this solution works I'm happy to submit a pull request. Thanks everyone for the tagging feature, it's otherwise working out GREAT for us!
The text was updated successfully, but these errors were encountered:
hoverbird
changed the title
TagsAtStartOfFlowContainerWithPathString() throwing an exception for some stories
TagsAtStartOfFlowContainerWithPathString() throwing an exception on some knots
Oct 15, 2016
Thanks for this report! This is the same as the issue that's currently open in the inkjs repo: y-lohse/inkjs#38
My bad: I wrote some code to inline containers so they don't get nested so deeply, but at some point recently MonoDevelop/Xamarin's unit tests became buggy and reported success even though they had an internal error half way through. I didn't realise that my changes had negative consequences :-/
Glad you've found a workaround! I expect my fix will be:
var path = new Runtime.Path (pathString);
// Expected to be global story, knot or stitch
var flowContainer = ContentAtPath (path) as Container;
var firstContentPath = flowContainer.pathToFirstLeafContent;
var firstContent = flowContainer.ContentAtPath (firstContentPath);
var firstContentContainer = firstContent.parent as Container;
...the important part being the pathToFirstLeafContent, which will work no matter what the nested structure is - a bit more robust than assuming that it's compiled in a certain way.
I haven't figured out why some paths in my story are throwing this exception and not others, but as far as I can tell there's nothing wrong with the knots it's failing on. The exception I'm seeing is:
It seems like in some of my knots, the first element in
flowContainer.Content
is not a compiled weave as the comment says it should be, but a tag.innerWeaveContainer
is then null, which throws the exception on Story.cs:1581 when we try to fetch its content.I found a workaround , which thusfar has fetched all my tags perfectly, but I'm not sure if this is a viable fix or if I'm just covering up for something wrong with my story structure:
If this solution works I'm happy to submit a pull request. Thanks everyone for the tagging feature, it's otherwise working out GREAT for us!
The text was updated successfully, but these errors were encountered: