Skip to content

Commit

Permalink
Fix invalid handle error on map start
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikusch committed Feb 21, 2024
1 parent 29834fa commit f4d7d15
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion addons/sourcemod/scripting/friendlyfire.sp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <tf2_stocks>
#include <tf2utils>

#define PLUGIN_VERSION "1.2.1"
#define PLUGIN_VERSION "1.2.2"

#define TICK_NEVER_THINK -1.0
#define TF_CUSTOM_NONE 0
Expand Down Expand Up @@ -100,6 +100,8 @@ public void OnPluginStart()
{
RegPluginLibrary("friendlyfire");

Entity.Initialize();

ConVars_Initialize();
SDKHooks_Initialize();

Expand Down
10 changes: 5 additions & 5 deletions addons/sourcemod/scripting/friendlyfire/entity.sp
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ methodmap Entity
return view_as<Entity>(INVALID_ENT_REFERENCE);
}

if (!g_entityProperties)
{
g_entityProperties = new ArrayList(sizeof(EntityProperties));
}

int ref = IsValidEdict(entity) ? EntIndexToEntRef(entity) : entity;

if (!Entity.IsReferenceTracked(ref))
Expand Down Expand Up @@ -213,4 +208,9 @@ methodmap Entity
{
return g_entityProperties.FindValue(ref, EntityProperties::ref) != -1;
}

public static void Initialize()
{
g_entityProperties = new ArrayList(sizeof(EntityProperties));
}
}

0 comments on commit f4d7d15

Please sign in to comment.