[FIXED]Crash EQ2Emu :p

Old bugs stored here for reference.
Locked
User avatar
alfa
Team Member
Posts: 550
Joined: Fri Jul 27, 2007 6:24 pm
Location: France
Contact:

[FIXED]Crash EQ2Emu :p

Post by alfa » Thu Feb 23, 2012 11:25 am

Using SF client, testing some bow trick, I have try to unequip bow and range attack. No action, no message, no response from server when I try to equip bow or view stat of a new item.

Maybe crash cause by range attack calculation whitout stat :p
Fight with me... Or die, like the rest.
J.A. say: "I think Xinux tried to tell me this, but I ignore most things he suggests."

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Crash EQ2Emu :p

Post by John Adams » Fri Feb 24, 2012 7:51 am

Definitely a crash, and in the damn LogWrite again. SCAT!

Why is this wrong?

Code: Select all

if(fighter->IsPlayer())
{
	weapon = ((Player*)fighter)->GetEquipmentList()->GetItem(EQ2_RANGE_SLOT);
	ammo = ((Player*)fighter)->GetEquipmentList()->GetItem(EQ2_AMMO_SLOT);
	LogWrite(COMBAT__DETAIL, "Combat", "Weapon '%s', Ammo '%s'", weapon->name.c_str(), ammo->name.c_str());
}
Not only is COMBAT__DETAIL off, but the name's are c_str()'d so why is this crashing world?

Commenting out for now.

Edit: Ohhh.... if Alfa unequipped both weapon and ammo, there would be no values. Is this the issue? and, would this fix it?

Code: Select all

LogWrite(COMBAT__DETAIL, "Combat", "Weapon '%s', Ammo '%s'", ( weapon )? weapon->name.c_str() : "None", ( ammo ) ? ammo->name.c_str() : "None");

But, the more important question:
Why is this logger crashing when COMBAT__DETAIL is disabled?

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: Crash EQ2Emu :p

Post by Scatman » Sat Feb 25, 2012 6:00 pm

Yes thats the appropriate fix. Not sure why its crashing there. Im stuck in philly this weekend moving my girlfriend to a new apartment and painting and all that jazz so i will get to it on monday.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Crash EQ2Emu :p

Post by John Adams » Sun Feb 26, 2012 10:30 am

I've already fixed and committed it. Hoping Alfa will try that action to see if he can get it to crash again.

Scat, you know the rules on "no girlfriends", they are a detriment to EQ2Emulator's progress ;)

User avatar
alfa
Team Member
Posts: 550
Joined: Fri Jul 27, 2007 6:24 pm
Location: France
Contact:

Re: Crash EQ2Emu :p

Post by alfa » Sun Feb 26, 2012 11:14 am

Well it seem to be ok
Fight with me... Or die, like the rest.
J.A. say: "I think Xinux tried to tell me this, but I ignore most things he suggests."

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: Crash EQ2Emu :p

Post by Scatman » Sun Feb 26, 2012 10:15 pm

John Adams wrote:I've already fixed and committed it. Hoping Alfa will try that action to see if he can get it to crash again.

Scat, you know the rules on "no girlfriends", they are a detriment to EQ2Emulator's progress ;)
Yes i know. I keep her locked in the basement but as a x4 raid mob she escaped and i couldnt take her down solo :(

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Crash EQ2Emu :p

Post by John Adams » Tue Feb 28, 2012 12:59 pm

Scatman wrote:Yes i know. I keep her locked in the basement but as a x4 raid mob she escaped and i couldnt take her down solo :(
Noob.

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: Crash EQ2Emu :p

Post by Scatman » Tue Feb 28, 2012 6:45 pm

This was crashing because even though COMBAT__DETAIL is disabled, you're still trying to access a function of a NULL object. So since the variable 'ammo' was null, calling c_str() on a NULL pointer resulted in a crash. This is because it needs to call c_str() before LogWrite() can even get called, so it never even got into the LogWrite() function.

So adding the check for ammo==NULL is the appropriate and only fix we need here.

Locked

Who is online

Users browsing this forum: No registered users and 0 guests