Skip to content

fix: NPE with not spawned npcs due to missing inventories#1554

Merged
derklaro merged 1 commit intonightlyfrom
fix/npc-null-inventories
Dec 15, 2024
Merged

fix: NPE with not spawned npcs due to missing inventories#1554
derklaro merged 1 commit intonightlyfrom
fix/npc-null-inventories

Conversation

@0utplay
Copy link
Member

@0utplay 0utplay commented Dec 12, 2024

Motivation

When an NPC is spawned, the inventory of the NPC is created too. But we only spawn NPCs if they are located in a loaded chunk, therefore we have them tracked, but they do not have a corresponding inventory yet. This leads to an NPE when interacting with an already spawned NPC.

Modification

Turned around our equals check for inventories when processing clicks on items. This ensures that no NPE can occur.

Result

Clicking on NPC selector items is working properly again.

@0utplay 0utplay added v: 4.X This pull should be included in the 4.0 release t: fix A pull request introducing a fix for a bug. in: module An issue/pull request releated to one of the internal modules labels Dec 12, 2024
@0utplay 0utplay added this to the 4.0.0-RC12 milestone Dec 12, 2024
@0utplay 0utplay requested a review from derklaro December 12, 2024 07:39
@0utplay 0utplay self-assigned this Dec 12, 2024
@derklaro derklaro merged commit da47c4c into nightly Dec 15, 2024
@derklaro derklaro deleted the fix/npc-null-inventories branch December 15, 2024 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: module An issue/pull request releated to one of the internal modules t: fix A pull request introducing a fix for a bug. v: 4.X This pull should be included in the 4.0 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants