extensions/sdkhooks/natives.cpp
changeset 3963 39fc1ce67130
parent 3767 7223d0a452a8
child 4054 0964336bb978
     1.1 --- a/extensions/sdkhooks/natives.cpp	Wed Jul 31 18:42:15 2013 -0400
     1.2 +++ b/extensions/sdkhooks/natives.cpp	Wed Jul 31 22:03:59 2013 -0400
     1.3 @@ -57,10 +57,19 @@
     1.4  			pContext->ThrowNativeError("Hook type not supported on this game");
     1.5  			break;
     1.6  		case HookRet_BadEntForHookType:
     1.7 -			pContext->ThrowNativeError("Hook type not valid for this type of entity (%s)",
     1.8 -				PEntityOfEntIndex(gamehelpers->ReferenceToIndex(params[1]))->GetClassName()
     1.9 -				);
    1.10 +		{
    1.11 +			const char * pClassname = gamehelpers->GetEntityClassname(PEntityOfEntIndex(gamehelpers->ReferenceToIndex(params[1])));
    1.12 +			if (!pClassname)
    1.13 +			{
    1.14 +				pContext->ThrowNativeError("Hook type not valid for this type of entity (%i).", entity);
    1.15 +			}
    1.16 +			else
    1.17 +			{
    1.18 +				pContext->ThrowNativeError("Hook type not valid for this type of entity (%s)", pClassname);
    1.19 +			}
    1.20 +			
    1.21  			break;
    1.22 +		}
    1.23  	}
    1.24  
    1.25  	return 0;