Commit 4fea5365 by Hanif Bin Ariffin

Check pointers against nullptr.

parent 58034f39
...@@ -285,7 +285,7 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li ...@@ -285,7 +285,7 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
* If it is null, the current function returns. * If it is null, the current function returns.
*/ */
#define ERR_FAIL_NULL(m_param) \ #define ERR_FAIL_NULL(m_param) \
if (unlikely(!m_param)) { \ if (unlikely(m_param == nullptr)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null."); \ _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null."); \
return; \ return; \
} else \ } else \
...@@ -296,7 +296,7 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li ...@@ -296,7 +296,7 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
* If it is null, prints `m_msg` and the current function returns. * If it is null, prints `m_msg` and the current function returns.
*/ */
#define ERR_FAIL_NULL_MSG(m_param, m_msg) \ #define ERR_FAIL_NULL_MSG(m_param, m_msg) \
if (unlikely(!m_param)) { \ if (unlikely(m_param == nullptr)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null.", DEBUG_STR(m_msg)); \ _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null.", DEBUG_STR(m_msg)); \
return; \ return; \
} else \ } else \
...@@ -310,7 +310,7 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li ...@@ -310,7 +310,7 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
* If it is null, the current function returns `m_retval`. * If it is null, the current function returns `m_retval`.
*/ */
#define ERR_FAIL_NULL_V(m_param, m_retval) \ #define ERR_FAIL_NULL_V(m_param, m_retval) \
if (unlikely(!m_param)) { \ if (unlikely(m_param == nullptr)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null."); \ _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null."); \
return m_retval; \ return m_retval; \
} else \ } else \
...@@ -321,7 +321,7 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li ...@@ -321,7 +321,7 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
* If it is null, prints `m_msg` and the current function returns `m_retval`. * If it is null, prints `m_msg` and the current function returns `m_retval`.
*/ */
#define ERR_FAIL_NULL_V_MSG(m_param, m_retval, m_msg) \ #define ERR_FAIL_NULL_V_MSG(m_param, m_retval, m_msg) \
if (unlikely(!m_param)) { \ if (unlikely(m_param == nullptr)) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null.", DEBUG_STR(m_msg)); \ _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Parameter \"" _STR(m_param) "\" is null.", DEBUG_STR(m_msg)); \
return m_retval; \ return m_retval; \
} else \ } else \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment