inkle / inkle/ink

nullref after reload -> save on "previousContentObject"

Open
#901 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.9k
Forks
540
PR merge metrics
No merged PRs in 30d

Description

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!!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.