diff options
Diffstat (limited to 'src/utils/checkutils.h')
-rw-r--r-- | src/utils/checkutils.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/utils/checkutils.h b/src/utils/checkutils.h index 7b76da8f1..52545e5cb 100644 --- a/src/utils/checkutils.h +++ b/src/utils/checkutils.h @@ -73,6 +73,22 @@ return ret; \ } +#define returnNullptrV(val) \ + if ((val) == nullptr) \ + { \ + reportStack(__FILE__, __LINE__, __func__, \ + "Detected null value", #val); \ + return; \ + } + +#define returnNullptr(ret, val) \ + if ((val) == nullptr) \ + { \ + reportStack(__FILE__, __LINE__, __func__, \ + "Detected null value", #val); \ + return ret; \ + } + void reportStack(const char *const file, const unsigned int line, const char *const func, @@ -102,5 +118,13 @@ void reportStack(const char *const file, if (val) \ return ret; +#define returnNullptrV(val) \ + if ((val) == nullptr) \ + return; \ + +#define returnNullptr(ret, val) \ + if ((val) == nullptr) \ + return ret; \ + #endif // ENABLE_ASSERTS #endif // UTILS_CHECKUTILS_H |