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

DB: Fix crash in waypoint_scripts #1342

Merged

Conversation

Winfidonarleyan
Copy link
Member

@Winfidonarleyan Winfidonarleyan commented Jan 22, 2019

CHANGES PROPOSED:
ISSUES ADDRESSED:

Closes #1336

TESTS PERFORMED:
  • Tested in game
HOW TO TEST THE CHANGES:
  1. Make a new Draenei (any class)
  2. Teleport to azure watch .tele azurewatch
  3. Talk to NPCs
KNOWN ISSUES AND TODO LIST:
Target branch(es): Master

NOTE: In TC ASSERT(data->GetOpcode() != MSG_NULL_ACTION); delete. Maybe we should delete it too?

template<class Builder>
void Trinity::LocalizedPacketDo<Builder>::operator()(Player* p)
{
    LocaleConstant loc_idx = p->GetSession()->GetSessionDbLocaleIndex();
    uint32 cache_idx = loc_idx+1;
    WorldPacket* data;

    // create if not cached yet
    if (i_data_cache.size() < cache_idx + 1 || !i_data_cache[cache_idx])
    {
        if (i_data_cache.size() < cache_idx + 1)
            i_data_cache.resize(cache_idx + 1);

        data = new WorldPacket();

        i_builder(*data, loc_idx);

        ASSERT(data->GetOpcode() != MSG_NULL_ACTION);

        i_data_cache[cache_idx] = data;
    }
    else
        data = i_data_cache[cache_idx];

    p->SendDirectMessage(data);
}
template<class Builder>
void Trinity::LocalizedPacketDo<Builder>::operator()(Player* p)
{
    LocaleConstant loc_idx = p->GetSession()->GetSessionDbLocaleIndex();
    uint32 cache_idx = loc_idx+1;
    WorldPacket* data;

    // create if not cached yet
    if (i_data_cache.size() < cache_idx + 1 || !i_data_cache[cache_idx])
    {
        if (i_data_cache.size() < cache_idx + 1)
            i_data_cache.resize(cache_idx + 1);

        data = new WorldPacket();

        i_builder(*data, loc_idx);

        i_data_cache[cache_idx] = data;
    }
    else
        data = i_data_cache[cache_idx];

    p->SendDirectMessage(data);
}
  • Diff
- ASSERT(data->GetOpcode() != MSG_NULL_ACTION);

@sucofog
Copy link
Contributor

sucofog commented Jan 22, 2019

@Winfidonarleyan TrinityCore/TrinityCore@4073cc5#diff-e55c649851fd21ac6ced06fb292b258f ---> ASSERT(data->GetOpcode() != MSG_NULL_ACTION);

@Winfidonarleyan
Copy link
Member Author

Winfidonarleyan commented Jan 22, 2019

@sucofog oh, yes, I think need to be ported this commit, later. Thanks.

@wetbrownsauce
Copy link

Tested.

Artificer Daelo in Azure Watch no longer crashes worldserver when moving along his waypoint, broadcasting text.

@Winfidonarleyan
Copy link
Member Author

@wetbrownsauce Thanks for testing.

@Winfidonarleyan Winfidonarleyan merged commit f6d0002 into azerothcore:master Jan 22, 2019
@Winfidonarleyan Winfidonarleyan deleted the broadcast_text_fix branch January 22, 2019 23:05
@robens robens mentioned this pull request Feb 19, 2019
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.

None yet

5 participants