Skip to content

Commit f480163

Browse files
committed
do not format the message if OnServerMessage is not enabled
1 parent a5e6ca1 commit f480163

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

src/Hooks.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -310,17 +310,19 @@ typedef void (*FUNC_logprintf)(const char *msg, ...);
310310

311311
void HOOK_logprintf(const char *msg, ...)
312312
{
313-
char buffer[1024];
314-
va_list arguments;
315-
va_start(arguments, msg);
316-
vsnprintf(buffer, sizeof(buffer), msg, arguments);
317-
va_end(arguments);
318-
319313
bool bAllow;
320-
if (CPlugin::Get()->IsOnServerMessageEnabled())
314+
if(CPlugin::Get()->IsOnServerMessageEnabled())
315+
{
316+
char buffer[1024];
317+
va_list arguments;
318+
va_start(arguments, msg);
319+
vsnprintf(buffer, sizeof(buffer), msg, arguments);
320+
va_end(arguments);
321+
321322
bAllow = CCallbackManager::OnServerMessage(buffer);
322-
else
323+
}else{
323324
bAllow = true;
325+
}
324326

325327
if(bAllow)
326328
{

0 commit comments

Comments
 (0)