Skip to content

Conversation

@Kraballa
Copy link

@Kraballa Kraballa commented Jul 24, 2025

My last fix attempt didn't work but this one does. There is a problem when using this module and the junk-to-gold module. When picking up an item, the junk to gold module removes it from the world and the player but the item pickup function in this module still gets called. Then the module tries to retrieve the itemtemplate and crashes. These modules shouldn't interfere due to item quality for enchants, but they do.

Changes Proposed:

  • Before applying an enchant, check if the item is still in the world. This actually works unlike checking whether its state is set to item_removed, checking for nullptr (it's not), or anything else I've tried.

Issues Addressed:

  • closes https://github.com/azerothcore/mod-random-enchants/issues/32

SOURCE:

Here's an image where the two modules are shown working together:
at the top: item receives enchants. at the bottom: item automatically sold.
image

Tests Performed:

  • see image above
  • I also played for the last 2 hours and saw both modules work several times.

How to Test the Changes:

  1. install mod-random-enchants and mod-junk-to-gold
  2. kill mobs until a gray item drops and a non-gray weapon/armor (can set enchant chance to 100 to see)
  3. it doesn't crash. without this fix it crashes

@Nyeriah Nyeriah merged commit 02a2e0d into azerothcore:master Jul 24, 2025
1 check passed
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.

2 participants