Skip to content

Commit

Permalink
Properly handle nullptr on TranslateWeaponEntForClass
Browse files Browse the repository at this point in the history
A null charptr returns -1 on SDKCall.

Closes #21.
  • Loading branch information
nosoop committed Jun 3, 2023
1 parent dda70cf commit 15ae719
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripting/tf_econ_data.sp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <stocksoup/handles>
#include <stocksoup/memory>

#define PLUGIN_VERSION "0.19.0"
#define PLUGIN_VERSION "0.19.1"
public Plugin myinfo = {
name = "[TF2] Econ Data",
author = "nosoop",
Expand Down Expand Up @@ -519,7 +519,7 @@ int GetProtoDefIndex(Address pProtoDefinition) {
}

static bool TranslateWeaponEntForClass(char[] buffer, int maxlen, int playerClass) {
return SDKCall(g_SDKCallTranslateWeaponEntForClass, buffer, maxlen, buffer, playerClass);
return SDKCall(g_SDKCallTranslateWeaponEntForClass, buffer, maxlen, buffer, playerClass) > 0;
}

static Address GameConfGetAddressOffset(Handle gamedata, const char[] key) {
Expand Down

0 comments on commit 15ae719

Please sign in to comment.