Fixed crashes on invalid report hooks

This commit is contained in:
Snaipe 2015-08-19 17:48:41 -07:00
parent d052330c21
commit a6a6c4c79f

View file

@ -33,13 +33,15 @@
#include "config.h"
#include "posix-compat.h"
static inline void nothing() {}
#define IMPL_CALL_REPORT_HOOKS(Kind) \
IMPL_SECTION_LIMITS(f_report_hook, HOOK_SECTION(Kind)); \
void call_report_hooks_##Kind(void *data) { \
for (f_report_hook *hook = GET_SECTION_START(HOOK_SECTION(Kind)); \
hook < (f_report_hook*) GET_SECTION_END(HOOK_SECTION(Kind)); \
++hook) { \
(*hook)(data); \
(*hook ?: nothing)(data); \
} \
}