Skip to content

Fix "NULL pointer to instance" error#7

Open
tjensen wants to merge 1 commit into
Dumpgrah:mainfrom
tjensen:fix-null-error-on-unlock
Open

Fix "NULL pointer to instance" error#7
tjensen wants to merge 1 commit into
Dumpgrah:mainfrom
tjensen:fix-null-error-on-unlock

Conversation

@tjensen

@tjensen tjensen commented Apr 19, 2026

Copy link
Copy Markdown

@Dumpgrah For your consideration, this PR fixes a "NULL pointer to instance" error when unlocking a combination lock that is attached to a Building Fortifications door.

The modded `UnlockServer` method override casts the parent (door) entity
to both a `BF_DoorBarricade` and a `BF_DoubleDoorBarricade` to check
whether the parent is one of these types. It then attempts to get the
inventory of both cast objects, one of which is always guaranteed to be
null. However, the `GetInventory` method exists on the original
`EntityAI` type, so there's no need to get the inventory via the cast
objects, and it only needs to be called once.
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

Successfully merging this pull request may close these issues.

1 participant