FYI: Don't call GetLastUsedBy if OBJECT_SELF has been delete

Scripted ALFA systems & related tech discussions (ACR)

Moderators: ALFA Administrators, Staff - Technical

Locked
User avatar
Basilica
Orc Champion
Posts: 477
Joined: Sat Jan 08, 2011 8:28 am

FYI: Don't call GetLastUsedBy if OBJECT_SELF has been delete

Post by Basilica »

It seems that this will crash the server.

Normally this is not a problem, but we had a script on one of the modules that used ExecuteScript() to re-run a placeable OnUsed script with a different object as the OBJECT_SELF. In this case, sometimes the other object that the script was run with could have been deleted.

That caused the server to crash, apparently, when the ExecuteScript instance of the script called GetLastUsedBy (ACR_PlaceableOnUsed calls GetLastUsedBy).

The moral of the story is to avoid playing tricks with calling GetLastUsedBy if OBJECT_SELF has gone away. The most likely case for this to happen seems to be usage of ExecuteScript on an object that has been deleted.
- Basilica
Locked