Pushing result of GetDefaultByType into array causes crash.

Wed Jun 10, 2020 2:27 pm

Tested with GZDoom 4.4.1 x64.

The title may be misleading due to character limit. The array is a class array.

Can be reproduced like this:
1. Get Bullet-Eye (that's where I discovered it; guaranteed to crash)
2. Open the mod and navigate to ZActors/Weapons/BEWeaponBase.zsc, Line 345. Where it says
Code:
PickedWeapons.Push(CurrWeapon.GetClass());

change that to
Code:
PickedWeapons.Push(CurrWeapon);

then start a new game, type "summon newweaponcapsule", and shoot it. It will immediately crash to desktop.

I could try to cook up a smaller example if deemed necessary.

Re: Pushing result of GetDefaultByType into array causes cra

Fri Jun 12, 2020 9:01 am

The example is fine. This should have aborted at compile time for a type mismatch, but the compiler does not catch this particular one.