Snippet Null g_pPlayer Crashes Fix

zOmbie

Administrator
Administrator
Joined
Jun 7, 2024
Messages
1,115
Solutions
29
Reaction score
1,208
Points
113
I think many of you had situations where your game window was crashed after teleport to another world.
There is 2 main reasons why it happens: first reason is inventory + any window where you can put any item for upgrading, for example, safe upgrade window.
As i remember, in this case ^ there is broken CItemElem pointer or something like that, that's why function CloseBoundWindow exist.
To avoid this crashes, make sure to check your custom systems and re-check classic flyff systems which have similar UI.

But main reason of crashes after teleport is null g_pPlayer pointer.
Instead of adding tons g_pPlayer checks in all OnDraw() / Process() etc functions, i decided to disable window processing in case if g_pPlayer is null.
The only exceptions are windows where g_pPlayer is not used, such as login window, select channel window etc.
I have no idea how good this approach is, but this way seems to working fine for me already 1.5 years.

How to fix?
I added fix to the v15 clean source and defined it as __NULL_PLAYER_FIX for your comfort. Find all related snippets inside provided archive and copy them to your source.

P.S:
You are more than welcome to fix it with own way, or suggest anything related to my approach.
Also, if you using second password thingy, you should add this window to wndmanager.cpp function as additional exception.

Download:
Hey There!
Please login and(or) register to see this awesome content today.
 
I think many of you had situations where your game window was crashed after teleport to another world.
There is 2 main reasons why it happens: first reason is inventory + any window where you can put any item for upgrading, for example, safe upgrade window.
As i remember, in this case ^ there is broken CItemElem pointer or something like that, that's why function CloseBoundWindow exist.
To avoid this crashes, make sure to check your custom systems and re-check classic flyff systems which have similar UI.

But main reason of crashes after teleport is null g_pPlayer pointer.
Instead of adding tons g_pPlayer checks in all OnDraw() / Process() etc functions, i decided to disable window processing in case if g_pPlayer is null.
The only exceptions are windows where g_pPlayer is not used, such as login window, select channel window etc.
I have no idea how good this approach is, but this way seems to working fine for me already 1.5 years.

How to fix?
I added fix to the v15 clean source and defined it as __NULL_PLAYER_FIX for your comfort. Find all related snippets inside provided archive and copy them to your source.

P.S:
You are more than welcome to fix it with own way, or suggest anything related to my approach.
Also, if you using second password thingy, you should add this window to wndmanager.cpp function as additional exception.

Download:
* Hidden text: cannot be quoted. *
again, thanks!
 
Much love for your releases Zombie, thanks!