Check if requests for interfaces succeed
IBinTools might not be available if we're running on a newer SourceMod version than the extension is compiled against.
This commit is contained in:
		
							parent
							
								
									0a5cab577a
								
							
						
					
					
						commit
						9d07c9d74c
					
				| @ -113,12 +113,21 @@ void SourceTVManager::SDK_OnAllLoaded() | |||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 	SM_GET_LATE_IFACE(BINTOOLS, bintools); | 	SM_GET_LATE_IFACE(BINTOOLS, bintools); | ||||||
|  | 	if (!bintools) | ||||||
|  | 	{ | ||||||
|  | 		smutils->LogError(myself, "Could not find interface: %s. Won't be able to send events to local spectators only.", SMINTERFACE_BINTOOLS_NAME); | ||||||
|  | 	} | ||||||
| 	SM_GET_LATE_IFACE(SDKTOOLS, sdktools); | 	SM_GET_LATE_IFACE(SDKTOOLS, sdktools); | ||||||
|  | 	if (!sdktools) | ||||||
|  | 	{ | ||||||
|  | 		smutils->LogError(myself, "Could not find interface: %s. Some functions won't work.", SMINTERFACE_SDKTOOLS_NAME); | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	g_pSTVForwards.Init(); | 	g_pSTVForwards.Init(); | ||||||
| 	SetupNativeCalls(); | 	SetupNativeCalls(); | ||||||
| 
 | 
 | ||||||
| 	iserver = sdktools->GetIServer(); | 	if (sdktools) | ||||||
|  | 		iserver = sdktools->GetIServer(); | ||||||
| 	if (!iserver) | 	if (!iserver) | ||||||
| 		smutils->LogError(myself, "Failed to get IServer interface from SDKTools. Some functions won't work."); | 		smutils->LogError(myself, "Failed to get IServer interface from SDKTools. Some functions won't work."); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -35,6 +35,7 @@ | |||||||
| #include "extension.h" | #include "extension.h" | ||||||
| #include "amtl/am-vector.h" | #include "amtl/am-vector.h" | ||||||
| #include "amtl/am-utility.h" | #include "amtl/am-utility.h" | ||||||
|  | #include "amtl/am-autoptr.h" | ||||||
| 
 | 
 | ||||||
| class HLTVServerWrapper { | class HLTVServerWrapper { | ||||||
| public: | public: | ||||||
|  | |||||||
| @ -235,6 +235,9 @@ static bool BroadcastEventLocal(IHLTVServer *server, IGameEvent *event, bool bRe | |||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | 		if (!bintools) | ||||||
|  | 			return false; | ||||||
|  | 
 | ||||||
| 		PassInfo pass[2]; | 		PassInfo pass[2]; | ||||||
| 		pass[0].flags = PASSFLAG_BYVAL; | 		pass[0].flags = PASSFLAG_BYVAL; | ||||||
| 		pass[0].type = PassType_Basic; | 		pass[0].type = PassType_Basic; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user