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

nullref after reload -> save on "previousContentObject" #901

Open
Alex-Sand-0 opened this issue May 22, 2024 · 0 comments
Open

nullref after reload -> save on "previousContentObject" #901

Alex-Sand-0 opened this issue May 22, 2024 · 0 comments

Comments

@Alex-Sand-0
Copy link

Hi,
I encountered a nullref in ink on this line: (ink 1.1.1)
https://github.com/inkle/ink/blob/master/ink-engine-runtime/CallStack.cs#L145

I was reloading a state after changing the ink scripts, and the previous "previousContentObject" was pointing to a stitch I had renamed.
The weird thing is that I had no problems loading this state, but I got a crash when trying to save again, immediately after loading. (I do that as a kind of "automatic testing" of my game serialization).
It looks like can avoid the crash just with adding a null check, like in the snippet below , my question is: how is this "previousContentObject" used ? Which problems should I expect from just ignoring this error?

                if (!previousPointer.isNull)
                {
                    var path = previousPointer.Resolve()?.path?.ToString();
                    if (path != null)
                    {
                        writer.WriteProperty("previousContentObject", path);
                    }
                    else
                    {
                        // Question:  should we expect further problems  ??
                    }
                }

Thanks for your help, and thanks for this great lib!!

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

1 participant