Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler crashes when diverting to choice or gather labels with parameters #208

Open
benabutler opened this issue Dec 4, 2024 · 2 comments

Comments

@benabutler
Copy link

If an ink file attempts to pass an argument while diverting to a choice or gather label, the compiler will crash with this stack:

Ink Compiler threw exception 
Error: Object reference not set to an instance of an object
---- Trace ----
  at Ink.Parsed.Divert.GenerateRuntimeObject () [0x000cb] in Assets\Ink\InkLibs\InkCompiler\ParsedHierarchy\Divert.cs:90 
  at Ink.Parsed.Object.get_runtimeObject () [0x00012] in Assets\Ink\InkLibs\InkCompiler\ParsedHierarchy\Object.cs:55 
  at Ink.Parsed.Weave.GenerateRuntimeObject () [0x0009b] in Assets\Ink\InkLibs\InkCompiler\ParsedHierarchy\Weave.cs:198 
  at Ink.Parsed.Object.get_runtimeObject () [0x00012] in Assets\Ink\InkLibs\InkCompiler\ParsedHierarchy\Object.cs:55 
  at Ink.Parsed.FlowBase.GenerateRuntimeObject () [0x0019f] in Assets\Ink\InkLibs\InkCompiler\ParsedHierarchy\FlowBase.cs:247 
  at Ink.Parsed.Object.get_runtimeObject () [0x00012] in Assets\Ink\InkLibs\InkCompiler\ParsedHierarchy\Object.cs:55 
  at Ink.Parsed.FlowBase.GenerateRuntimeObject () [0x000eb] in Assets\Ink\InkLibs\InkCompiler\ParsedHierarchy\FlowBase.cs:217 
  at Ink.Parsed.Object.get_runtimeObject () [0x00012] in Assets\Ink\InkLibs\InkCompiler\ParsedHierarchy\Object.cs:55 
  at Ink.Parsed.Story.ExportRuntime (Ink.ErrorHandler errorHandler) [0x0013b] in Assets\Ink\InkLibs\InkCompiler\ParsedHierarchy\Story.cs:155 
  at Ink.Compiler.Compile () [0x00085] in Assets\Ink\InkLibs\InkCompiler\Compiler.cs:53 
  at Ink.UnityIntegration.InkCompiler.CompileInkThreaded (System.Object itemObj) [0x00085] in Assets\Ink\Editor\Core\Compiler\InkCompiler.cs:576 
--------

It looks to me like the Divert.GenerateRuntimeObject assumes targetContent will be a FlowBase if the user is providing arguments, but gathers and choices are just regular Ink.Parsed.Object objects. I don't think passing arguments to a gather point is valid Ink syntax - I only hit the crash because I mistyped something - but the compiler should probably provide a nice error message like it does for diverting with parameters to knots that don't take parameters.

Here's a repro demonstrating the behavior:
InkCompilerCrashRepro.txt

I found this issue on v1.2.0 while using the ink-unity-integration plugin v1.2.1, but also reproduced it on a standalone build of inky v1.1.0.

@tomkail
Copy link
Collaborator

tomkail commented Dec 4, 2024 via email

@benabutler
Copy link
Author

Sure, new issue opened here: inkle/ink#921

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants